What's the best way to disable the default /console route in Flask debug mode?

牧云@^-^@ 提交于 2019-12-10 21:27:48

问题


I want my application's dashboard area to be called /console. However, Flask uses werkzeug.debug.DebuggedApplication (http://werkzeug.pocoo.org/docs/debug/), which uses /console as the default Debug path. Flask itself only has the debug flag,

app.run(debug=True)

with no other options to override that path. What are my options?

I temporarily added the following, but I'd rather not have to do that because I have some intricate thing's going on in JS on the front-end, like a redirect during registration, etc.

if app.debug:
  app.register_blueprint(.., url_prefix='/con')
else:
  app.register_blueprint(..., url_prefix='/console')

回答1:


Set use_evalex=False in your app.run call to disable the console but still have reloading and the pretty Werkzeug "Don't Panic" debugger:

if __name__ == '__main__':
    app.run(debug=True, use_evalex=False)


来源:https://stackoverflow.com/questions/21345221/whats-the-best-way-to-disable-the-default-console-route-in-flask-debug-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!