Django error - ModuleNotFoundError: No module named 'polls.ulrs'

I just write the code the create app in django , its named "polls", configure like below:

my project\urls.py

from django.contrib import admin
from django.urls import include, re_path

urlpatterns = [
    re_path('admin/', admin.site.urls),
    re_path(r'^$', include("polls.ulrs")),
    # path("", include("polls.ulrs")),
]

my project\settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls'
]

polls\ulrs.py

from django.urls import re_path
 
from . import views 
 
urlpatterns = [ 
     re_path(r'^$', views.index, name='index'),

]

polls\views

from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse
 
def index(request):
    response = render()
    response.write("<h1>Welcome</h1>")
    response.write("This is the polls app")
    return response

The issue i got as below, could you please help look this?

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\urls\conf.py", line 38, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'polls.ulrs'

In your project urls.py you have a typo error it is polls.urls

from django.contrib import admin
from django.urls import include, re_path

urlpatterns = [
    re_path('admin/', admin.site.urls),
    re_path(r'^$', include("polls.urls")), #-------> typo error here
    # path("", include("polls.ulrs")),
]
Back to Top