【问题标题】:IDE showing me error on objects keyword in " latest_questions = Question.objects.order_by('-pub_date')[:10] "IDE 在“ latest_questions = Question.objects.order_by('-pub_date')[:10] ”中显示对象关键字错误
【发布时间】:2020-06-19 00:45:33
【问题描述】:
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.

【问题讨论】:

    标签: python django object model


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2012-09-06
      • 2022-01-19
      • 2019-01-17
      • 2013-01-21
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-07
      相关资源
      最近更新 更多