我正在尝试设置django-registration-redux,但是当我设置
时url(r'^accounts/', include('registration.backends.default.urls')),
在urls.py文件中的,我尝试访问任何页面,我收到以下错误消息:
ModuleNotFoundError
No module named 'django.urls'
我已多次检查手册,一切都井然有序。缺什么?我的错误在哪里?
"""p110 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import include, url
from django.contrib import admin
from boletin import views
from .views import about
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', views.index, name='index'),
url(r'^contact/$', views.contact, name='contact'),
url(r'^about/$', about, name='about'),
url(r'^accounts/', include('registration.backends.default.urls')),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
答案 0 :(得分:2)
最新版本的django-registration-redux requires Django 1.11+。如果您使用的是早期版本的Django,那么您可以使用django-registration-redux 1.9,supports Django 1.8+。
请注意,您应该真正升级到Django 1.11或更高版本。 Django 1.9和1.10不再受支持,对Django 1.8的长期支持将于2018年4月结束。