def create_web_app(app: App) -> Flask:
    wsgi = Flask(__name__)
    wsgi.register_blueprint(ep)
    wsgi.register_blueprint(admin)
    wsgi.teardown_request(close_session)
    wsgi.errorhandler(NoResultFound)(handle_no_result_found)
    wsgi.jinja_env.filters['kst'] = to_kst
    wsgi.config.update(app.web_config)
    wsgi.config['APP'] = app
    wsgi.secret_key = app.secret_key
    wsgi.wsgi_app = SassMiddleware(wsgi.wsgi_app, {
        'pycon2018': ('static/css', 'static/css', 'static/css')
    })
    login_manager.init_app(wsgi)
    if wsgi.config.get('CDN_DOMAIN'):
        cdn = CDN()
        cdn.init_app(wsgi)
    if app.sentry_dsn:
        Sentry(wsgi, dsn=app.sentry_dsn)
    return wsgi
Beispiel #2
0
app.config['SQLALCHEMY_POOL_SIZE'] = 100
app.config['CDN_DOMAIN'] = 'd30bzjua38r0w8.cloudfront.net'
app.config['CDN_HTTPS'] = True
app.config['CDN_DEBUG'] = True

# DB Config
db.init_app(app)
redis = Redis()
redis.init_app(app)

# Migration Config
migration = Migrate(app, db)

# Session Config
app.secret_key = THE_SECRET_KEY
app.config['SESSION_TYPE'] = 'filesystem'
Session(app)

# CDN Config
cdn.init_app(app)

# flask-compress config
compress.init_app(app)

# flask-login config
login_manager.init_app(app)


# Late import so modules can import their dependencies properly
from app import models, views