我想列出目錄和子目錄中的文件。我已經使用this answer列表,但這些項目是不可點擊的,所以我想在文件名稱和位置之間添加一個鏈接。我試圖用這樣的東西修改模板:在帶有燒瓶的目錄中列出文件
<!doctype html>
<title>Path: {{ tree.name }}</title>
<h1>{{ tree.name }}</h1>
<ul>
{%- for item in tree.children recursive %}
<li><a href="{{ item.name }}">{{ item.name }}</a>
{%- if item.children -%}
<ul><a href="{{ loop(item.children) }}">{{ loop(item.children) }}</a></ul>
{%- endif %}</li>
{%- endfor %}
</ul>
但它不起作用,鏈接不好。 Wheareas我想鏈接到http://192.168.0.70:5000/static/repertory/subrepertory/file
,我有一個鏈接http://192.168.0.70:5000/file
,這導致了404。有人能幫助我嗎?
相關:[如何使用Python生成html目錄列表](https://stackoverflow.com/q/10961378/4279) – jfs