找不到服务器上找不到请求的URL。如果您手动输入URL,请检查拼写并重试。瓶子

2024-03-29 05:00:54 发布

您现在位置:Python中文网/ 问答频道 /正文

I am trying to pass a row value of table for displaying in a new route if a user wants to see all full details of that row in a new page. row is a dictionary which I want to pass.this is one of many tds in a table created in maintable.html page

<td>
    <a href="{{ url_for('details' , row = row )}}" class="btn btn-info""> View</a>
</td>

the route which I created and declared in my init.py is as follow :

    @app.route("/details/<row>")
    def details(row):
        return render_template("details.html", row = row )

this is my details.html page

    <!DOCTYPE html>
<html lang="en">
<head>
  some other codes
</head>
<body> 

<div class="container">
  <div class="well">Website</div>
  <p class="lead">
    {{row.website}}
  </p>
  
  <div class="well">Title</div>
  <p class="lead">
    {{row.title}}
  </p>

  <div class="well">Organization</div>
  <p class="lead">
    {{ row.organization }}
  </p>

  <div class="well">Description</div>
  <p class="lead">
    {{ row.description }}
  </p>

  <div class="well">Close Date</div> 
  <p class="lead">
    {{ row.close_date }}
  </p>

  <div class="well">Downlaods</div> 
  <p class="lead">
    {{ row.close_date }}
    {% for link in row.downloads %}
      {% if link != '' %}
      <a href="{{ link }}">[{{ loop.index }}]</a>
    {% else %} 
      <p>N/A</p>     
    {% endif %}
    {% endfor %}
    </td>
  
  </p>



</div>

</body>
</html>

when I click on the view button it gives me error as: Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

有人能帮我确定我的代码是否正确地传递了行,以及如何修复错误吗。 我正在努力学习,非常感谢你的帮助


Tags: ofthetoindivforishtml