gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
chạy django lỗi File "C:\Users\iSPACE\mysite\mysite\urls.py", line 22, in <module>…
- User
chạy django lỗi File "C:\Users\iSPACE\mysite\mysite\urls.py", line 22, in path('home/', include('home.urls')), ^^^^^^^ NameError: name 'include' is not defined .
code : from django.contrib import admin from django.urls import path
urlpatterns = [ path('admin/', admin.site.urls), path('home/', include('home.urls')),
]
- Assistant
This error occurs because the
includefunction from thedjango.urlsmodule has not been imported. To fix this, add the following line at the top of your code:pythonfrom django.urls import path, includeThe updated code should be:
pythonfrom django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('home/', include('home.urls')), ]