-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (22 loc) · 719 Bytes
/
app.py
File metadata and controls
30 lines (22 loc) · 719 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
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_cors import CORS
from flask_jwt_extended import JWTManager
from config import Config
from boto3 import client
db = SQLAlchemy()
s3 = client('s3', aws_access_key_id=Config.AWS_ACCESS_KEY_ID,
aws_secret_access_key=Config.AWS_SECRET_ACCESS_KEY)
def create_app():
app = Flask(__name__)
app.config.from_object(Config)
jwt = JWTManager(app)
CORS(app)
db.init_app(app)
migrate = Migrate(app, db)
from controllers import api as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api')
with app.app_context():
db.create_all()
return app