from .config import Development as Config from .models import * from .extensions import db from flask import Flask from werkzeug.middleware.proxy_fix import ProxyFix def create_app(): app = Flask(__name__) app.config.from_object(Config()) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto = 1, x_host = 1) db.init_app(app=app) from .views import views app.register_blueprint( blueprint = views, url_prefix = '/api' ) """Create database before first request""" @app.before_first_request def _create_database_tables(): with app.app_context(): db.create_all() return app