Reputation: 53
I'm troubleshooting an issue with my urls.py file and I just noticed that the django default 404 page is returning "No Post matches the given query." in the body rather than
"Using the URLconf defined in X, Django tried these URL patterns in this order:
The current URL, myurl/ didn't match any of these."
Is this a toggle somewhere? I know I've seen it before...I'm using Django 1.5.1, DEBUG = TRUE is set in settings.py and I have other URLs defined in urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin, flatpages
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'blog.views.index'),
url(r'^(?P<slug>[\w\-]+)/$', 'blog.views.post'),
url(r'^contact/$', 'contact.views.contact'), #troubleshooting this one
)
Upvotes: 0
Views: 335
Reputation: 6921
I think that this is because you get the error because you use the shortcut function get_object_or_404 with Post model.
So the urls patterns work ok. Try to locate where you use this function and add some printing or break with pdb.
Upvotes: 1