英文:
Django path('challenges/',include(challenges.urls)) NameError: name 'challenges' is not defined
问题
当我注释掉以下部分:
urlpatterns = [
path('admin/', admin.site.urls),
#path('challenges/',include(challenges.urls))
]
它可以正常工作,但是当我使用以下部分:
urlpatterns = [
path('admin/', admin.site.urls),
path('challenges/',include(challenges.urls))
]
时,它会抛出一个错误。
为什么在我使用以下代码时出现错误:
urlpatterns = [
path('admin/', admin.site.urls),
path('challenges/',include(challenges.urls))
]
英文:
When I comment
urlpatterns = [
path('admin/', admin.site.urls),
#path('challenges/',include(challenges.urls))
]
it is working fine but for
urlpatterns = [
path('admin/', admin.site.urls),
path('challenges/',include(challenges.urls))
]
it is throwing an
error
why the error is occurring when I am using
urlpatterns = [
path('admin/', admin.site.urls),
path('challenges/',include(challenges.urls))
]
答案1
得分: 2
"path('challenges/', include('challenges.urls'))"
英文:
you have to write like this in quotes,
path('challenges/',include("challenges.urls"))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论