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?