简体   繁体   English

安装django-registration-redux时没有名为django.urls的模块

[英]No module named 'django.urls' when installing django-registration-redux

I'm trying to set up django-registration-redux , but when I set up the 我正在尝试设置django-registration-redux ,但是当我设置

url(r'^accounts/', include('registration.backends.default.urls')),

in the urls.py file and I try to access any page I get the following error message: 在urls.py文件中,我尝试访问任何页面,都会收到以下错误消息:

ModuleNotFoundError  
No module named 'django.urls'

I have checked the manual several times and everything is in order. 我已经多次检查了手册,一切正常。 What is missing? 什么东西少了? Where is my mistake? 我的错误在哪里?

urls.py file urls.py文件

"""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)

The latest version of django-registration-redux requires Django 1.11+ . 最新版本的django-registration-redux 需要Django 1.11+ If you are using an earlier version of Django, then you could use django-registration-redux 1.9, which supports Django 1.8+ . 如果您使用的是Django的早期版本,则可以使用django-registration-redux 1.9,它支持Django 1.8+

Note that you should really be upgrading to Django 1.11 or newer. 请注意,您实际上应该升级到Django 1.11或更高版本。 Django 1.9 and 1.10 are no longer supported, and long term support for Django 1.8 ends in April 2018. 不再支持Django 1.9和1.10,并且对Django 1.8的长期支持将于2018年4月终止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM