2021-01-24 13:58:29 +01:00
|
|
|
from flask import Flask
|
|
|
|
from flask_smorest import Api
|
|
|
|
from flask_marshmallow import Marshmallow
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from flask_migrate import Migrate
|
|
|
|
#from flask_jwt_extended import JWTManager
|
|
|
|
|
|
|
|
|
|
|
|
db = SQLAlchemy()
|
|
|
|
ma = Marshmallow()
|
|
|
|
#jwt = JWTManager()
|
|
|
|
|
|
|
|
|
|
|
|
def create_app(cfg='default'):
|
|
|
|
from config import config
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config.from_object(config[cfg])
|
|
|
|
app.url_map.strict_slashes = False
|
|
|
|
|
|
|
|
config[cfg].init_app(app)
|
|
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
|
|
|
|
from . import resources
|
|
|
|
|
2021-01-27 19:50:41 +01:00
|
|
|
api = Api()
|
2021-01-24 13:58:29 +01:00
|
|
|
api.init_app(app)
|
|
|
|
db.init_app(app)
|
|
|
|
ma.init_app(app)
|
|
|
|
#jwt.init_app(app)
|
|
|
|
Migrate(app, db)
|
|
|
|
resources.register_blueprints(api)
|
|
|
|
|
|
|
|
return app
|
|
|
|
|