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

StackOverflow https://stackoverflow.com/questions/21345221

  •  02-10-2022
  •  | 
  •  

سؤال

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')
هل كانت مفيدة؟

المحلول

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)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top