早在制作这个网站时,管理员工作正常,我回到它,现在却没有。
在/ admin /的ImportError 没有名为views的模块
错误。
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^PythonProject/', include('PythonProject.urls')),
url(r'^accounts/login/$', 'PythonPorject.views.login'),
url(r'^accounts/auth/$', 'PythonPorject.views.auth_view'),
url(r'^accounts/logout/$', 'PythonPorject.views.logout'),
url(r'^accounts/loggedin/$', 'PythonPorject.views.loggedin'),
url(r'^accounts/invalid/$', 'PythonPorject.views.invalid_login'),
)
如果我注释掉url(r'^ PythonProject /',include('PythonProject.urls')),那么我可以访问管理员。
from django.conf.urls import patterns, url
from PythonProject import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^about/$', views.about, name='about'),
url(r'^services/$', views.services, name='services'),
url(r'^pricingsystem/$', views.pricingSystem, name='pricingsystem'),
url(r'^contacts/$', views.contacts, name='contacts'),
url(r'^login/$', views.login, name='login'),
url(r'^register/$', views.register, name='register'),
url(r'^language/(?P<language>[a-z\-]+)/$', 'views.language'),
)
它使用的视图与此urls.py
位于同一目录中