-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (22 loc) · 683 Bytes
/
app.py
File metadata and controls
32 lines (22 loc) · 683 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
from os.path import dirname, abspath
from typing import Optional
from flask import Flask, url_for, flash
from orm import db
from models import User
from api import api_blueprint
from services.account_services import login_manager
from views import view_blueprint
app = Flask(__name__)
app.config.from_object("config")
app.register_blueprint(view_blueprint)
app.register_blueprint(api_blueprint, url_prefix="/api")
login_manager.init_app(app)
db.init_app(app)
@app.teardown_appcontext
def context_closure(error: Optional[Exception]):
if error is None:
db.session.commit()
else:
db.session.rollback()
if __name__ == "__main__":
app.run(port=8000)