def create_app(self): """ Create the wsgi application :return: application instance """ app_ = app.create_app() app_.config['SQLALCHEMY_BINDS']['libraries'] = \ TestCaseDatabase.postgresql_url return app_
def create_app(self): """ Create the wsgi application :return: application instance """ app_ = app.create_app() app_.config['SQLALCHEMY_BINDS']['libraries'] = \ TestCaseDatabase.postgresql_url return app_
def get_app_config(key): opath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if opath not in sys.path: sys.path.insert(0, opath) from biblib import app as application app = application.create_app() with app.app_context() as c: print('Getting actual config for', key, app.config.get(key)) return app.config.get(key)
def create_app(self): """ Create the wsgi application :return: application instance """ app_ = app.create_app(**{ 'SQLALCHEMY_DATABASE_URI': self.postgresql_url, 'SQLALCHEMY_ECHO': True, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True, 'VAULT_BUMBLEBEE_OPTIONS': {'foo': 'bar'} }) return app_
def create_app(self): """ Create the wsgi application :return: application instance """ app_ = app.create_app( **{ 'SQLALCHEMY_DATABASE_URI': self.postgresql_url, 'SQLALCHEMY_ECHO': True, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True, 'VAULT_BUMBLEBEE_OPTIONS': { 'foo': 'bar' } }) return app_
# -*- coding: utf-8 -*- """ wsgi ~~~~ entrypoint wsgi script """ from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from biblib import app application = app.create_app() if __name__ == "__main__": run_simple('0.0.0.0', 4000, application, use_reloader=False, use_debugger=True)
# -*- coding: utf-8 -*- """ wsgi ~~~~ entrypoint wsgi script """ from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from biblib import app application = app.create_app() if __name__ == "__main__": run_simple( '0.0.0.0', 4000, application, use_reloader=False, use_debugger=True )
def setUp(self): self._app = create_app() self._app.config['SQLALCHEMY_BINDS']['libraries'] = \ TestManagePy.postgresql_url self._app.config['BIBLIB_ADSWS_API_DB_URI'] = TestManagePy.adsws_sqlite
""" import os import sys PROJECT_HOME = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(PROJECT_HOME) from flask import current_app from flask_script import Manager, Command, Option from flask_migrate import Migrate, MigrateCommand from .models import Base, User, Permissions, Library from biblib.app import create_app from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session # Load the app with the factory app = create_app() class CreateDatabase(Command): """ Creates the database based on models.py """ @staticmethod def run(app=app): """ Creates the database in the application context :return: no return """ Base.metadata.create_all(bind=app.db.engine)
""" import os import sys PROJECT_HOME = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) sys.path.append(PROJECT_HOME) from flask import current_app from flask.ext.script import Manager, Command, Option from flask.ext.migrate import Migrate, MigrateCommand from models import db, User, Permissions, Library from biblib.app import create_app from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session # Load the app with the factory app = create_app() class CreateDatabase(Command): """ Creates the database based on models.py """ @staticmethod def run(app=app): """ Creates the database in the application context :return: no return """ with app.app_context(): db.create_all() db.session.commit()
def setUp(self): self._app = create_app() self._app.config['SQLALCHEMY_BINDS']['libraries'] = \ TestManagePy.postgresql_url self._app.config['BIBLIB_ADSWS_API_DB_URI'] = TestManagePy.adsws_sqlite