没有名为urls的模块

时间:2011-04-20 04:51:29

标签: python django import admin

点击管理页面后,我收到错误没有名为url的例外?

Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/
Django Version: 1.2.5
Exception Type: ImportError
Exception Value:    
No module named urls
Exception Location: /usr/local/lib/python2.6/dist-packages/django/utils/importlib.py in import_module, line 35
Python Executable:  /usr/bin/python
Python Version: 2.6.5
Python Path:    ['/usr/local/google/Myfiles/cheeserater', '/usr/local/buildtools/current/sitecustomize', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']
Server time:    Tue, 19 Apr 2011 23:49:27 -0500

1 个答案:

答案 0 :(得分:5)

您需要在主网址文件中包含管理网址

from django.contrib import  admin
admin.autodiscover()

(r'^admin/(.*)', admin.site.root)