Reputation: 2783
I am new to Djnago and getting following error when opening url - 127.0.0.1/hello could any on eplease help to figure this out..there is some error with module path but how to resolve it.
ImportError at /hello
No module named defaults
Request Method: GET
Request URL: http://127.0.0.1:8000/hello
Django Version: 1.6.2
Exception Type: ImportError
Exception Value: No module named defaults
Exception Location: /home/mkp/Desktop/djcode/mysite/mysite/urls.py in <module>, line 14
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path: ['/home/mkp/Desktop/djcode/mysite',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
Server time: Sun, 20 Apr 2014 16:42:25 +0000
urls.py:-
from django.conf.urls.defaults import patterns, include, url
from mysite.views import hello
urlpatterns = patterns('',
url(r'^hello/$', hello),
)
views.py:-
from django.http import HttpResponse
def hello(request):
return HttpResponse("Hello world")
Upvotes: 1
Views: 54
Reputation: 473863
You need to fix your import statement in urls.py
. Replace:
from django.conf.urls.defaults import patterns, include, url
with:
from django.conf.urls import patterns, include, url
Upvotes: 1