Using Python flask to develop how to manage host port

Source: Internet
Author: User
Tags passthrough

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.