1 2 3 4 5 6 7 | # serve media in development mode and expose the 400/500 docs for testing
if settings.DEVELOPMENT_MODE:
urlpatterns += patterns('',
url(r"%s(?P<path>.*)$" % settings.MEDIA_URL[1:], 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
url(r'^500/$', 'django.views.generic.simple.direct_to_template', {'template': '500.html'}),
url(r'^404/$', 'django.views.generic.simple.direct_to_template', {'template': '404.html'}),
)
|
More like this
- A custom 500 handler which is AJAX-aware by mallipeddi 5 years, 4 months ago
- Easy configuration for relocatable sites by gsakkis 2 years, 10 months ago
- Publishing service endpoint uri to javascript by dberansky 3 years ago
- Decorator for enabling views only when developing by damd 2 years, 10 months ago
- Add validation for 'unique' and 'unique_together' constraints to newforms created dynamically via form_for_model or form_for_instance by bikeshedder 6 years ago
Comments
This doesn't really work for the 500 template. In testing with this urlconf, your 500 template will be rendered with context from all your context processors. In a real 500 error, Django does not make that context available and your 500 template could look very different (if, say, you depend on media_url to get media).
And generating a real 404 is never very hard to do.
#