I am following Django tutorial given in the following link:-
http://docs.djangoproject.com/en/1.4/intro/tutorial01/
While running server I get many error messages:-
ImportError at /admin/
No module named polls.urls
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.4.1
Exception Type: ImportError
Exception Value:
No module named polls.urls
Exception Location: C:\Python27\lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.3
Python Path:
['D:\\chetan\\All_My_Projects\\mysite1',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages']
The errors are similar to what has been asked in:-
My question is, do we need to add the project directory,which in my case would be D:\chetan\All_My_Projects\mysite1 to environment variable? Is this causing the problem..
This is the whole Django Project ( I suppose, you are on Windows, using Py 27 )
Follow these steps:
open cmd, direct it to
d:\, Nowpython c:/python27/lib/site-packages/django/bin/django-admin.py startproject mysitecd mysiteandpython manage.py startapp pollsNow,
cd pollsGo to d:/mysite/mysite/settings.py and add
pollsinINSTALLED_APPSvery important: open mysite/mysite/urls.py
add
url(r'^home$', include('polls.urls') ),to url patternsNow, runserver and open
/home/polls