Flask - Script add_option method does not work

Using the script script add_optionmethod I am trying to transfer the name of the configuration file to mine create_app()so I can configure from_pyfile()- Folders of instances flack

I used this gist to get started.

manage.py

from fbone import create_app

app = create_app()
manager = Manager(app)
manager.add_option('-c', '--config', dest='config', required=False)

app.py

def create_app(config=None, app_name=None, blueprints=None):
    """Create a Flask app."""

    print config

This is just a snippet of my function create_app, but I run the application as follows:

$ python manage.py -c config/heroku.cfg runserver
None
/env/lib/python2.7/site-packages/flask_script/__init__.py:153: UserWarning: Options will be ignored.
* Running on http://127.0.0.1:5000/
* Restarting with reloader
None

As you can see, instead of printing, config/heroku.cfgit prints. None I think this is because UserWarningof a flask script, but I can’t understand why this is happening.

+4
source share
1 answer

, , create_app() ( ).

app=create_app

Manager(create_app)

  add_option()

+4

All Articles