Django:ImportError,没有名为urls的模块

时间:2012-12-20 18:27:34

标签: python django django-urls

我的项目目录中有以下urls.py文件:

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('wb.views',
    url(r'^areas/$', 'arealist'),
    url(r'^areas/(?P<area_id>\d+)/$', 'area_roomlist'),
    url(r'^areas/(?P<area_id>\d+)/rooms/(?P<room_id>\d+)/$', 'area_roomdetail'),
    url(r'^areas/add_area/$','add_area'),
    url(r'^areas/area_added/$', 'area_added'),
    url(r'^rooms/$', 'roomlist'),
    url(r'^rooms/(?P<room_id>\d+)/$', 'roomdetail'),
    url(r'^rooms/add_room/$', 'add_room'),
    url(r'^rooms/room_added/$', 'room_added'),
    url(r'^room_exits/$', 'room_exit_list'),
    url(r'^room_exits/add_room_exit/$', 'add_room_exit'),
    url(r'^room_exits/room_exit_added/$', 'room_exit_added'),
)

urlpatterns += patterns('',
    url(r'^admin/', include(admin.site.urls)),
)

每当我尝试加载页面时,都会出现以下错误:

ImportError at /page/, No module named urls

任何人都知道发生了什么事吗?提前谢谢。

1 个答案:

答案 0 :(得分:7)

在settings.py中将ROOT_URLCONF设置为错误的urls.py路径。遗憾!