Reputation: 45074
My Django project always gives me a 404, no matter what page I'm trying to visit. Being a Django noob, I have no idea how to troubleshoot this. Any suggestions?
Edit: here's my urls.py
:
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^mcifdjango/', include('mcifdjango.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
Upvotes: 0
Views: 1107
Reputation: 118438
What kind of behavior were you expecting?
You have no urls mapped to anything -- you should only be getting 404s!
import http
def a_view(request):
return http.HttpResponse("My first mapped url")
urlpatterns = patterns('',
(r'^$', a_view), # my first url mapped to anything
(r'^second_url/$', a_view), # my second non 404 url
)
Upvotes: 3
Reputation: 4055
You have to include a mapping from urls to views in your urls.py. For more information:
http://docs.djangoproject.com/en/dev/topics/http/urls/
Upvotes: 0