为了账号安全,请及时绑定邮箱和手机立即绑定

尽管进行了更改,但Django-URL未显示页面

尽管进行了更改,但Django-URL未显示页面

慕娘9325324 2021-04-08 10:11:39
这是index.html{% extends 'base.html' %}{% block content %}<h1>list of  {{title}}</h1>{% if questions %}    <ul>        {% for question in questions %}        <li>           <a href="/polls/{{question.id}}/details/"> {{question.title}}</a>        </li>        {% endfor %}    </ul>        {% else %}        <p>there is a no question available</p>        {% endif %}{% endblock %}details.html{% extends 'base.html' %}{% block content %}<H2>Details Page</H2><h3>{{question.title}}</h3>{% for choice in question.choices %}<p>{{choice.text}}({{choice.votes}})</p>{% empty %}<p>There is no choice available for this Question</p>{% endfor %}<p>Poll is created by {{question.created_by.first_name}}</p>{% endblock %}这是base.html{%load static%}<html><head>    <meta charset="UTF-8">    <title>WebPage</title>    <link rel="stylesheet" href="(%static 'css/custom.css'%)"></head><body><h1>Welcome to My Page</h1>{%  block content %}{% endblock %}</body></html>还有poll.urlsfrom django.conf.urls import urlfrom poll.views import *urlpatterns = [    url('', index, name='polls_list'),    url('<int:id>/details/', details, name='polls_details')]所以这就是发生的事情,我在index.html上显示了3个问题,单击它们中的任何一个,它将更改为正确的url,但没有打开请求的页面。我该如何解决。请记住,我两天前才刚开始django,所以请原谅我的天真。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 222 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号