def app(): """Flask app instance.""" _app = create_app(config) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
#!/usr/bin/env python """Worker module for creating celery workers.""" from matl_online.app import create_app, celery from matl_online.settings import config app = create_app(config) app.app_context().push() celery.conf.update(app.config)
def test_production_config(): """Production config.""" app = create_app(ProdConfig) assert app.config['ENV'] == 'prod' assert app.config['DEBUG'] is False assert app.config['ASSETS_DEBUG'] is False
def test_dev_config(): """Development config.""" app = create_app(DevConfig) assert app.config['ENV'] == 'dev' assert app.config['DEBUG'] is True assert app.config['ASSETS_DEBUG'] is True
from glob import glob from subprocess import call from flask_migrate import Migrate, MigrateCommand from flask_script import Manager, Server, Shell, Command, Option from flask_script.commands import Clean, ShowUrls from matl_online.app import create_app, socketio from matl_online.database import db from matl_online import matl from matl_online.settings import config eventlet.monkey_patch() app = create_app(config) manager = Manager(app) migrate = Migrate(app, db) def _make_context(): """Return context dict for a shell session.""" return {'app': app, 'db': db} @manager.command def test(): """Run the tests.""" import pytest test_path = os.path.join(config.PROJECT_ROOT, 'tests')
"""Script for initializing a production app for use with uwsgi.""" import eventlet eventlet.monkey_patch() from matl_online.app import create_app from matl_online.settings import ProdConfig app = create_app(ProdConfig)