Website backend _python+flask.0005.flask debug mode open Debug and pin use?

Source: Internet
Author: User

Auto Load:

# Way One

if __name__ = = ' __main__ ': App.run (host= ' 0.0.0.0 ', port=9000, Debug=true)

# Way Two

if __name__ = = ' __main__ ': App.debug = True app.run (host= ' 0.0.0.0 ', port=9000)

Note: The debug mode can be opened in two ways, debugging mode, the Py file will be modified automatically reload, resource file/template file/profile modification must be restarted effective ~ This really wood has a way ~


Exception Debugging:

# code Area

#!/usr/bin/env python#-*-coding:utf-8-*-"" "# # authors:limanman# 51ctobg:http://xmdevops.blog.51cto.com/# Purpose:# "" "# Description: Import public module from flask import flask# Description: Import other module app = Flask (__name__) app.config.update () @app. Route ('/') def hello_word ( ): return Noneif __name__ = = ' __main__ ': App.run (host= ' 0.0.0.0 ', port=9000, Debug=true)


# display Area

* Restarting with stat * Debugger is active! * Debugger Pin code:160-043-266 * Running on http://0.0.0.0:9000/(press CTRL + C to quit)


# Debug Area

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/89/50/wKioL1gPaj3DDVc0AAAiPGqyUOo428.png "title=" Clipboard.png "alt=" Wkiol1gpaj3ddvc0aaaipgqyuoo428.png "/>

Note: When the error occurs, it automatically returns a debug interface that can get the error context and executable code, WERKZEUG for security, a random pin private authentication code will be generated at startup, and the pin will be forced to enter the wrong stack mode the first time the debugger is started. Werkzeug will then store it in a cookie for a 8-hour expiration time.


This article is from "@Can up and No BB ..." Blog, be sure to keep this source http://xmdevops.blog.51cto.com/11144840/1865636

Website backend _python+flask.0005.flask debug mode open Debug and pin use?

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.