Looking at page 16 of the <<flask web development>> article, when doing example 2-3,
from flask import Flask
app = Flask(__name__)
from flask.ext.script import Manager
manager = Manager(app)
@app.route('/user/<name>')
def user(name):
return '<h1>Hello, %s!</h1>' % name
if __name__=='__main__':
manager.run() gives
the following error when running:
E:\Python36>python hello.py
hello.py:42: ExtDeprecationWarning: Importing flask.ext.script is deprecated, use flask_script instead.
from flask.ext.script import Manager
usage: hello.py [-?] {shell,runserver} ...
positional arguments:
{shell,runserver}
shell Runs a Python shell inside Flask application context.
runserver Runs the Flask development server i.e. app.run()
optional arguments:
-?, --help show this help message and exit
This tells us two useful pieces of information, the first is that we should import from flask_script import Manager
The second is when running, we should write E:\Python36>python hello.py runserver
Finally the perfect solution!