Closed ChenHaolinOlym closed 3 years ago
Blueprints must be registered after app init (because the process depends on app parameters like OpenAPI version for the docs).
from flask_smorest import Api
api = Api()
blp=Blueprint()
# Some settings
def register_blueprints():
api.register_blueprint(blp)
from .interface import api, register_blueprints
def create_app():
app=Flask(__name__)
api.init_app(app)
register_blueprints()
Thanks for your help
I want to use init_app to initialize the application and I want to put all my api part of code into a separate .py file. So I do something below: interface.py:
__init__.py
I would get an error: AttributeError: 'NoneType' object has no attribute 'register_blueprint' This is because I register blueprint before I init_app I really want to organize my code like this so can flask-smorest support this?