-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (21 loc) · 653 Bytes
/
app.py
File metadata and controls
32 lines (21 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Configuration must be loaded very early
from bootstrap.config import prepare_config
prepare_config() # noqa
from filters import init_jinja_filters
from core.routes import register_routes
from core.database import db_session, init_db
from flask import Flask
def create_flask_app():
app = Flask(__name__)
app.template_folder = 'core/views'
_import_flask_config(app)
register_routes(app)
init_jinja_filters(app)
return app
def _import_flask_config(app: Flask):
app.config.from_prefixed_env()
app = create_flask_app()
init_db()
@app.teardown_appcontext
def shutdown_session(exception=None):
db_session.remove()