django urls.py regex isn't working
Posted
by
Phil
on Stack Overflow
See other posts from Stack Overflow
or by Phil
Published on 2011-02-19T23:16:49Z
Indexed on
2011/02/19
23:25 UTC
Read the original article
Hit count: 426
This is for Django 1.2.5 and Python 2.7 on Wamp Server running apache version 2.2.17.
My problem is that the my URLConf in urls.py isn't redirecting, it's just throwing a 404 error.
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('',
(r'^app/$', include('app.views.index')),
# 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)),
)
views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello World")
I'm getting the following error: ImportError at /app/ No module named index
I'm stumped as I'm only learning Django, can anybody see something wrong with my code? Here's my PythonPath: ['C:\Windows\system32\python27.zip', 'C:\Python27\Lib', 'C:\Python27\DLLs', 'C:\Python27\Lib\lib-tk', 'C:\wamp\bin\apache\Apache2.2.17', 'C:\wamp\bin\apache\apache2.2.17\bin', 'C:\Python27', 'C:\Python27\lib\site-packages', 'c:\wamp\www\seetwo']
© Stack Overflow or respective owner