Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs can't register view function #224

Open
ischaojie opened this issue Aug 3, 2021 · 1 comment
Open

docs can't register view function #224

ischaojie opened this issue Aug 3, 2021 · 1 comment

Comments

@ischaojie
Copy link

ischaojie commented Aug 3, 2021

I use flask factory mode, register docs in create_app, by got TypeError.

def create_app():
    app = Flask(__name__)
    # config
    app.config.from_object(config)

    # register urls
    app.register_blueprint(drogo_openid)
    app.register_blueprint(api)  # api
    app.register_blueprint(admin)
    app.register_blueprint(error)  # error

    register_extensions(app)

    register_docs(app)

    return app


def register_blueprint(app):
    pass


def register_extensions(app):
    docs.init_app(app)


def register_docs(app):
    for (fpath, view_function) in app.view_functions.items():
        blueprint_name = fpath.split('.')[0]
        if ismethod(view_function):
            docs.register(view_function, blueprint=blueprint_name)

In addition, use docs.register(...) in create_app got the same error, Please help

@educanovas93
Copy link

Any solution ? I have the same issue :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants