2017-12-19 17:03:51 +01:00
|
|
|
from flask import Flask
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
2018-01-30 04:30:52 +01:00
|
|
|
db = SQLAlchemy(session_options={"autoflush": False, "autocommit": False, "expire_on_commit": False})
|
2017-12-19 17:03:51 +01:00
|
|
|
|
|
|
|
def create_app():
|
|
|
|
|
2017-12-19 19:20:27 +01:00
|
|
|
from .app import main
|
|
|
|
from .settings import STATIC_ROOT
|
|
|
|
|
|
|
|
app = Flask(__name__, static_url_path=STATIC_ROOT)
|
|
|
|
app.register_blueprint(main)
|
2017-12-19 17:03:51 +01:00
|
|
|
|
|
|
|
SQLALCHEMY_DATABASE_URI = 'sqlite:///./db.sqlite'
|
|
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
|
|
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
db.init_app(app)
|
|
|
|
|
|
|
|
return app
|
|
|
|
|