[英]No module named 'django.urls'
I have a problem: 我有个问题:
ImportError at / No module named 'django.urls'
urls.py: urls.py:
from django.contrib import admin
from django.urls import path
from polls.views import *
urlpatterns = [
path('', EnterPage, name='home'),
path('admin/', admin.site.urls),
path('main/',EnterPage),
path('login/',loginn),
path('admin-panel/',adminPan),
path('control-users/',panel),
path('menu/',menu),
path('perspage/',lk),
path('spisok-zakazov/',product),
path('info/',info),
path('task-panel/', tasks),
path('tasks/',earncoin)
]
I don't understand why I am getting this error. 我不明白为什么会收到此错误。
Maybe you're using an older django version. 也许您使用的是django的旧版本。 You can check your version using:
您可以使用以下方法检查您的版本:
python -c "import django; print(django.get_version())"
If you look at the django documentation there are several modifications including the urls module. 如果您查看django文档,则会进行一些修改,包括urls模块。
Version >= 2.0: https://docs.djangoproject.com/en/2.0/ref/urls/ 版本> = 2.0: https : //docs.djangoproject.com/en/2.0/ref/urls/
from django.urls import include, path
Version < 2.0: https://docs.djangoproject.com/en/1.11/ref/urls/ 版本<2.0: https : //docs.djangoproject.com/en/1.11/ref/urls/
from django.conf.urls import include, url
Django 2.0 release notes: Django 2.0发行说明:
https://docs.djangoproject.com/pt-br/2.1/releases/2.0/#simplified-url-routing-syntax https://docs.djangoproject.com/pt-br/2.1/releases/2.0/#simplified-url-routing-syntax
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.