1, #pip install Flask_script installation Flask_script Package
Flask-script is a Flask extension, for Flask The program adds a command-line parser. flask-script comes with a set of common options, and also supports custom commands.
2, import the Manager in the source code, the code is as follows:
From flask import Flaskfrom flask.ext.script Import Managerapp = Flask (__name__) Manager = Manager (APP) @app. Route ('/') def Index (): Return '
Save As Hello.py
3, the implementation of Python hello.py Runserver-?, results are as follows
usage:flask02c.py runserver [-?] [-H HOST] [-P PORT] [--threaded]
[--processes processes] [--passthrough-errors]
[-d] [-d] [-R] [-R]
Runs the Flask development server i.e. App.run ()
Optional arguments:
-?,--Help show this help message and exit
-h host,--host host
-p Port,--port port
--threaded
--processes processes
--passthrough-errors
-D,--debug enable the Werkzeug debugger
Code
-D,--no-debug disable the Werkzeug debugger
-R,--reload monitor Python files for changes (not 100{' const ':
True, ' help ': ' Monitor Python files for changes (not
100% safe for production use) ', ' option_strings ':
['-R ', '--reload '], ' dest ': ' Use_reloader ',
' Required ': False, ' Nargs ': 0, ' choices ': None,
' Default ': None, ' prog ': ' flask02c.py runserver ',
' Container ': <argparse._argumentgroup object at
0x10fe85190>, ' type ': None, ' Metavar ': None}afe for
Production use)
-R,--no-reload don't monitor Python files for changes
You can specify the associated host and port.
Using Python flask to develop how to manage host port