Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

documentation for Manager.add_option wrong? #118

@amagee

Description

@amagee

There's a code snippet in the docs as follows:

def create_my_app(config=None):
    app = Flask(__name__)
    if config:
        app.config.from_pyfile(config)

    return app

manager = Manager(create_my_app)
manager.add_option("-c", "--config", dest="config", required=False)
@manager.command
def mycommand(app):
    app.do_something()

The app argument to mycommand seems wrong; if I try to follow that pattern I get an error:

usage: manage.py runserver [-?] app
manage.py runserver: error: the following arguments are required: app

The example code code at https://github.com/smurfix/flask-script/blob/master/examples/manage.py works differently and it seems correct; if I remove the app argument from mycommand and use flask.current_app instead, everything works. Is this a mistake in the documentation or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions