作者catrush (貓兒衝鋒)
看板Python
標題[問題] 如何使用python和flask弄出html網頁
時間Fri Feb 14 20:15:24 2020
看一個老外的教學影片,也許是英文不夠好漏掉了什麼,有人知道問題在哪嗎
http://i.imgur.com/3dLNFET.jpg
http://i.imgur.com/t5uGBox.jpg
-----
Sent from JPTT on my HUAWEI JKM-LX2.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.52.136.66 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Python/M.1581682528.A.F83.html
1F:推 kerycheng: 不考慮Django嗎 02/14 20:22
2F:→ s860134: 試試把 index.html 換成 templates/index.html 02/14 20:24
3F:→ catrush: 樓上,仍然失敗,另外return test 有結果,的確是找html 02/14 20:39
4F:→ catrush: 檔的問題 02/14 20:39
5F:推 martin77: venv目錄內找不到templates目錄 02/14 20:49
6F:推 martin77: 要嘛你的app run的file寫在最外層. 不然比較結構的作法 02/14 20:52
7F:→ martin77: 應該是用application factory搭配blueprint 02/14 20:52
8F:→ s860134: 樓上是對的,先吧 index.py 往上搬一層驗證吧 02/14 20:53
9F:→ catrush: 哈哈,我成功了,感謝各位 02/14 21:12
11F:→ catrush: g 結果是讀取不到圖片 02/14 21:16
12F:→ s860134: 通常是用 url_for 去處理,不會直接寫路徑 02/14 21:25
14F:→ s860134: 第二個回答有官方文件連結可以參考 02/14 21:27
15F:噓 jiyu520: . 02/15 07:19
16F:推 kokolotl: static資料夾可以在app=flask(__name__, static_url_pat 02/15 09:22
17F:→ kokolotl: h=ooxx)設好 02/15 09:22
18F:推 nurockplayer: 可以去 Github 搜尋 The-Flask-Mega-Tutorial-zh 02/15 12:24
19F:推 hongyan: 想學flask推一下開發團隊成員李輝自己寫的書 02/16 16:13
21F:→ naestnecniv: 建議先把官方文件讀過至少tutorials吧,至少知道資 02/27 21:11
22F:→ naestnecniv: 料夾結構怎麼放 02/27 21:11