IDE 在 " latest_questions = Question.objects.order_by('-pub_date')[:10] " 中显示对象关键字错误


Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/polls/'polls/index.html
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/
^polls/ ^$ [name='index']
^polls/ ^(?P<question_id>[0-9]+)/$ [name='detail']
^polls/ ^(?P<question_id>[0-9]+)/results$ [name='results']he current path, polls/'polls/index.html, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

您的问题与IDE无关,您需要正确配置urls.py页面。Django似乎找不到"polls/'polls/index.html"地址。您需要转到urls.py文件并添加以下行;

path('polls/'polls/index.html/', views.path_to_function, name='index'),

最新更新