Good afternoon all,
Perhaps someone can give me a pointer here:
I'm an old hand at Django (1.0 to 1.6) but now in 1.8.2, the documented process of writing and attaching custom handlers for '404' and '500' appears to have stopped working.
As per the dox, I have added into my ROOT url file, the required overrides:
and I can confirm that this default 404.html file is indeed getting rendered, but not by my routine:
views.py
-----------
def custom_handler(request):
print '——>>> got to here'
return HttpResponseNotFound('<h1>Boo! - Page not found</h1>')
I've been testing with DEBUG=False under 'python manage.py runserver'.
My custom handler never, *ever* fires when a URL not in my apikey/urls.py file is submitted by a GET and a 404 is supposed to be raised.
I am at a complete loss as to why this isn't working, having had no issues with this custom handler process over the past 5 years :(
-- Perhaps someone can give me a pointer here:
I'm an old hand at Django (1.0 to 1.6) but now in 1.8.2, the documented process of writing and attaching custom handlers for '404' and '500' appears to have stopped working.
As per the dox, I have added into my ROOT url file, the required overrides:
from django.conf.urls import *I have created the default 404.html template in the apikey/templates directory and updated the site settings file to reflect this
from django.contrib import admin
urlpatterns = [
url(r'^apikey/', include('apikey.urls', namespace='apikey')),
url(r'^admin/', include(admin.site.urls)),
]
handler404 = 'apikey.views.custom_handler'
handler500 = 'apikey.views.custom_handler'
and I can confirm that this default 404.html file is indeed getting rendered, but not by my routine:
views.py
-----------
def custom_handler(request):
print '——>>> got to here'
return HttpResponseNotFound('<h1>Boo! - Page not found</h1>')
I've been testing with DEBUG=False under 'python manage.py runserver'.
My custom handler never, *ever* fires when a URL not in my apikey/urls.py file is submitted by a GET and a 404 is supposed to be raised.
I am at a complete loss as to why this isn't working, having had no issues with this custom handler process over the past 5 years :(
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4cea481b-9db4-4eb1-8d7f-57d3e44d60b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment