How to use Werkzeug interactive traceback debugger in a Django project hosted on Heroku?

走远了吗. 提交于 2019-12-24 03:29:46

问题


With django-extensions installed in your Django project, on a local machine you can use manage.py runserver_plus to have the very useful Werkzeug debugger active, so that the 500 error page lets you poke around with your stack interactively.

How do you activate the Werkzeug-enabled 500 page when running from Heroku?


回答1:


If you are using gunicorn to serve your Django application on Heroku like on their tutorial https://devcenter.heroku.com/articles/django, you will not be able to see the Werkzeug debbuger because gunicorn does not use Werkzeug.

You have to serve you django application on Heroku using wsgi based server that uses Werkzeug like uWSGI. See -> https://github.com/unbit/uwsgi-docs/blob/master/tutorials/heroku_python.rst

Also DEBUG = True on your heroku settings must be set.

Having DEBUG = True on your production environment(heroku) is greatly discouraged because someone can view your settings(passwords) and even code.



来源:https://stackoverflow.com/questions/16069705/how-to-use-werkzeug-interactive-traceback-debugger-in-a-django-project-hosted-on

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