Error: name 'include' is not defined

362 views
Skip to first unread message

Larry Stevens

unread,
Mar 22, 2023, 8:53:15 AM3/22/23
to Django users
Hello,

I'm brand new to Django taking an online course in Python.
I created a project named 'django_test' and I'm in the process of creating a very simple app named 'Hello_World'.

I'm trying to modify the urls.py file in my 'django_test' project for the app 'hello_world'.
My code in urls.py follows:
from django.contrib import admin
from django.urls import path
urlpatterns = [
    path('admin/', admin.site.urls),
    path('hello_world/', include('hello_world.urls'))
]

The return error is     name 'include' is not defined

I tried to import include with the statement     from django.conf.urls import include
which also failed.

Thank you for reading my post.

Larry Stevens

Jeman Kumar

unread,
Mar 22, 2023, 8:56:38 AM3/22/23
to django...@googlegroups.com
hi, replace the line "from django.urls import path" to "from django.urls import path, include"

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4e2c7426-b451-4542-9629-52d4f4707a94n%40googlegroups.com.

Harouna Diallo

unread,
Mar 22, 2023, 9:49:20 AM3/22/23
to django...@googlegroups.com
You must Import include : from django.urls import path, include

--

Robinson

unread,
Mar 22, 2023, 11:16:58 AM3/22/23
to django...@googlegroups.com

Larry Stevens

unread,
Mar 22, 2023, 11:24:18 AM3/22/23
to Django users
Perfect, problem solved.
Thank you so much Jeman, Harouna, and Robinson.
Greatly appreciated.

Ikrombek

unread,
Mar 23, 2023, 10:23:07 PM3/23/23
to Django users
How can I use for dental clinic, For example, do I need to include 32 fields from the model to specify 32 teeth, or is there a way to do it in one?

Larry Stevens

unread,
Apr 2, 2023, 10:59:00 AM4/2/23
to django...@googlegroups.com
Perfect, thank you 
Larry Stevens


You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/hi9S4ZEcla4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO73PDopg--cbbBgX3OQuNwfp%3DyMpSf_Uzga894CXvzOAy1mAA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages