创建django项目故障:Exception Value: name 'admin' is not defined

出错信息:

NameError at /admin/

name ‘admin’ is not defined












































Request Method:GET
Request URL:http://127.0.0.1:8000/admin/
Django Version:1.4
Exception Type:NameError
Exception Value:
name ‘admin’ is not defined

Exception Location:in <module>, line 19
Python Executable:C:\Python27\python.exe
Python Version:2.7.0
Python Path:
[‘C:\Documents and Settings\netcat\\xd7\xc0\xc3\xe6\Django-1.4\Django-1.4\django\bin\blog’,
‘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’]

Server time:Wed, 18 Apr 2012 23:18:20 +0800

解决方法:

在urls.py文件中添加一行

from django.contrib import admin