issues with include()

I’ve recently started the tutorial and the server instantly crashes, when i try to run it.
How can it be when its basically just copied and pasted?

Import view below

from django.shortcuts import render
from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

urls.py below

from app import views

from django.contrib import admin

from django.urls import include, path

urlpatterns = [

    **path('polls/', include('polls.urls')),**
    path('admin/', admin.site.urls),
    path('', views.index, name='index'),
]

What i know of path(‘polls/’, include(‘polls.urls’)), causing the crash, but as

The tutorial stats

When to use include()
You should always use include() when you include other URL patterns. admin.site.urls is the only >exception to this.

so what is not correct ?

Whenever asking about an error here, it’s always helpful to post the complete error message.

Also, with reference to the tutorial, it helps if you identify which page and paragraph you’re on, so we know what should have been done to this point.

Without that information, my first question would be, have you created your urls.py file in the polls app yet? If so, what are its contents?

(As a side note, I always recommend against copy/paste the tutorial code. You learn a whole lot more by typing it in. Your brain ends up having to focus on the details of every line, enhancing your comprehension and improving knowledge retention. You’re not doing yourself any favors by taking a short-cut.)

Well first i’d like to thank you for the reply @KenWhitesell .

(As a side note, I always recommend against copy/paste the tutorial code. You learn a whole lot more by typing it in. Your brain ends up having to focus on the details of every line, enhancing your comprehension and improving knowledge retention. You’re not doing yourself any favors by taking a short-cut.)

This case is just referred to the end of the tutorial 1/7
where you learn about the include function

Also, with reference to the tutorial, it helps if you identify which page and paragraph you’re on, so we know what should have been done to this point.

Usually never do copy and paste, unless there is an error which i do not understand at all. just to see if it works, when you do copy and paste. i like the challange where you’re using the tutorial(s) just as an reference.

here is the urls.py

urls.py below

from app import views

from django.contrib import admin

from django.urls import include, path

urlpatterns = [

    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),
    path('', views.index, name='index'),
]

here is the views.py

from django.shortcuts import render
from django.http import HttpResponse


def index(request):
    return HttpResponse("my first django app")

Error from the managa.py


File "C:\Users\krigj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\django\urls\resolvers.py", line 413, in check  
    messages.extend(check_resolver(pattern))

  File "C:\Users\krigj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method() 

 File "C:\Users\krigj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\django\urls\resolvers.py", line 413, in check    
    messages.extend(check_resolver(pattern))

That’s your “root” urls.py file that you’ve posted here. What about the urls.py file in the polls app? (The file that you’re trying to include.) It’s the sample block directly above the modifications for the root urls.py file.

Im so sorry for i wasted your time @KenWhitesell. I appreciated the assistance which you provided.

i were expecting everything were included in the package. but i were not right. It irritated me for a bit, but i understood how the article tutorial on how to work with include files. It were as it were. i expected that they were talking about the same urls.py file, but that were the error. there were two types of urls where polls.url inclue shouid be pointing to the root folder of the application.

Thank you again, its appreciated the assistance which you provided.

Please - no apologies necessary and no time was wasted. You’ve learned something along the way, and that after all, is the purpose for the tutorial.

Cheers!