-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
31 lines (25 loc) · 845 Bytes
/
app.py
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
import os
import traceback
from flask import Flask
from flask_cors import CORS
from util import get_database_url
from models.database import db, migrate
from models.casting import Actor, Movie, actor_movie_relation
from routes import health_blueprint, casting_blueprint
from errors import errors_blueprint
def create_app(database_url):
app = Flask(__name__)
app.config['JSON_SORT_KEYS'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = database_url
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)
migrate.init_app(app, db)
CORS(app)
app.register_blueprint(health_blueprint)
app.register_blueprint(casting_blueprint)
app.register_blueprint(errors_blueprint)
return app
database_url = get_database_url()
app = create_app(database_url)
if __name__ == '__main__':
app.run()