Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/

后端 未结 1 1735
心在旅途
心在旅途 2021-01-25 06:53

I was following the django documentation and making a simple poll app. I have come across the following error :

Using the URLconf defined in mysite.urls, Dja         


        
相关标签:
1条回答
  • 2021-01-25 07:18

    You get the 404 on http://127.0.0.1:8000/ because you have not created any URL patterns for that url. You have included the url http://127.0.0.1:8000/polls/, because you have included the polls urls with

    url(r'^polls/',include('polls.urls')),
    

    The empty bullets suggest that there is a problem with your polls/index.html template. It looks like you have a typo and have put {{ question.question_test }} instead of {{ question.question_text }}. Make sure that it exactly matches the template from the tutorial 3:

    {% if latest_question_list %}
        <ul>
        {% for question in latest_question_list %}
            <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li>
        {% endfor %}
        </ul>
    {% else %}
        <p>No polls are available.</p>
    {% endif %}
    
    0 讨论(0)
提交回复
热议问题