import os from flask_migrate import Migrate from core.factories import create_app from core.extensions import db config_name = os.getenv('APP_SETTINGS', 'default') app = create_app(config_name) migrate = Migrate(app, db) @app.shell_context_processor def make_shell_context(): return dict(app=app, db=db)
def app(): app = create_app(__name__, 'testing') ctx = app.app_context() ctx.push() yield app ctx.pop()
import os from werkzeug.middleware.dispatcher import DispatcherMiddleware from werkzeug.serving import run_simple from prometheus_client import make_wsgi_app from core.factories import create_app, SettingsError settings_name = "production" flask_app = create_app(settings_name) app = DispatcherMiddleware(flask_app, {"/metrics": make_wsgi_app()}) if __name__ == "__main__": run_simple("0.0.0.0", 8080, app, use_reloader=False, use_debugger=flask_app.config["DEBUG"])
import os from flask_script import Manager from core.factories import create_app config_name = os.getenv('APP_SETTINGS', 'default') app = create_app(__name__, config_name) manager = Manager(app) if __name__ == "__main__": manager.run()
import os from core.factories import create_app, SettingsError if __name__ == '__main__': if os.environ['APP_SETTINGS']: settings_name = os.environ['APP_SETTINGS'] else: raise SettingsError("\'APP_SETTINGS\' environment " "variable is not defined") app = create_app(__name__, settings_name) app.run(debug=app.app.config['DEBUG'], host='0.0.0.0', port=80)