Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22462

Vladimir Iakolev: Using Werkzeug with Django on App Engine

$
0
0

Werkzeug has a pretty decent error page with in-browser debugger and some other features. In just Django project it can be easily used with django-extensions with:

./manage.py runserver_plus

But we can't use this approach with gae, because it doesn't use runserver, it just works through wsgi. So instead we should wrap our wsgi application with DebuggedApplication. So in wsgi.py (or another file where wsgi app defined) we need to change an app initialization to something like:

fromdjango.core.wsgiimportget_wsgi_applicationfromdjango.confimportsettingsfromwerkzeug.debugimportDebuggedApplicationapplication=get_wsgi_application()ifsettings.DEBUG:app=DebuggedApplication(app,True)# Werkzeug won't work without exceptions propagationsettings.DEBUG_PROPAGATE_EXCEPTIONS=True

And that's all.


Viewing all articles
Browse latest Browse all 22462

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>