我正在使用默认 Web 服务器在 Windows 7 上使用 Django 1.4 进行尝试。该站点启动时没有错误。但是当我浏览到 localhost:8000 我收到以下错误
ImportError at /
No module named urls
我看到错误来自哪里
它在主 URLs.py 文件中 - (r'^admin/', include('django.contrib.admin.urls')),
如果我删除该表单 URLs.py 文件,则会出现主页。我在“C:\Python27\Lib\site-packages\django\contrib\admin”文件夹中看不到 urls.py 文件。所以,这个错误是有道理的。
但是这条线必须在那里才能让 Django-Registration 包工作。我读过的所有博客都有这一行。我如何通过这个?非常感谢您的错误。
按照以下 Siva 的说明修复了 url.py。但没有运气。
from django.conf.urls import patterns, include, url
from SOWLAPP.views import *
from CATALOG.views import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'SOWL.views.home', name='home'),
# url(r'^SOWL/', include('SOWL.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url (r'^user/(\w+)/$', user_page),
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^catalog/$', home),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{ 'document_root' : 'C:/SHIYAM/Personal/SuccessOwl/SOWL0.1/SOWL/SOWL/static'}),
(r'^admin/', include('django.contrib.admin.urls')),
(r'^accounts/', include('registration.urls')),
(r'^$', main_page),
)
问候, SHM