Ejemplo n.º 1
0
def create_app(config='config.ProductionConfig'):
    app = Flask(__name__)
    app.config.from_object(config)
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

    from db.setup import db
    db.init_app(app)

    _ = (User, Post, Token)

    api = Api(app)
    register_routes(api)

    app.register_blueprint(error_handlers.blueprint)

    api.app = app
    api.authorizations = {
        'apiKey': {
            'type': 'apiKey',
            'in': 'header',
            'name': 'X-API-KEY'
        }
    }

    return app
Ejemplo n.º 2
0
# from safrs import SAFRSAPI

app = Flask('myapp')
app.config['SECRET_KEY'] = '5791628bb0b13ce0c676dfde280ba245'

# app.wsgi_app = middleware(app.wsgi_app)

authorization = {
    'apikey': {
        'type': 'api-key',
        'in': 'header',
        'name': 'X-API-KEY'
    }
}
api_app = Api(app)
api_app.authorizations = authorization
# api = SAFRSAPI(app, api_spec_url=OAS_PREFIX+'/swagger')

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = "******"
app.config['MAIL_PASSWORD'] = "******"

db = SQLAlchemy(app)

ma = Marshmallow(app)

# manager = Migrate(app, db)