Reputation: 11
I have a problem:
ImportError at / No module named 'django.urls'
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.
Upvotes: 1
Views: 2232
Reputation: 66
Maybe you're using an older django version. 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.
Version >= 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/
from django.conf.urls import include, url
Django 2.0 release notes:
https://docs.djangoproject.com/pt-br/2.1/releases/2.0/#simplified-url-routing-syntax
Upvotes: 1