看板 Python 關於我們 聯絡資訊
看一個老外的教學影片,也許是英文不夠好漏掉了什麼,有人知道問題在哪嗎 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://www.ptt.cc/bbs/Python/M.1581682528.A.F83.html
kerycheng: 不考慮Django嗎 02/14 20:22
s860134: 試試把 index.html 換成 templates/index.html 02/14 20:24
catrush: 樓上,仍然失敗,另外return test 有結果,的確是找html 02/14 20:39
catrush: 檔的問題 02/14 20:39
martin77: venv目錄內找不到templates目錄 02/14 20:49
martin77: 要嘛你的app run的file寫在最外層. 不然比較結構的作法 02/14 20:52
martin77: 應該是用application factory搭配blueprint 02/14 20:52
s860134: 樓上是對的,先吧 index.py 往上搬一層驗證吧 02/14 20:53
catrush: 哈哈,我成功了,感謝各位 02/14 21:12
catrush: 另外有人知道怎麼放圖嗎?http://i.imgur.com/siEGp3V.jp 02/14 21:16
catrush: g 結果是讀取不到圖片 02/14 21:16
s860134: 通常是用 url_for 去處理,不會直接寫路徑 02/14 21:25
s860134: https://stackoverflow.com/a/17220327 02/14 21:26
s860134: 第二個回答有官方文件連結可以參考 02/14 21:27
jiyu520: . 02/15 07:19
kokolotl: static資料夾可以在app=flask(__name__, static_url_pat 02/15 09:22
kokolotl: h=ooxx)設好 02/15 09:22
nurockplayer: 可以去 Github 搜尋 The-Flask-Mega-Tutorial-zh 02/15 12:24
hongyan: 想學flask推一下開發團隊成員李輝自己寫的書 02/16 16:13
hongyan: http://helloflask.com/book/ 02/16 16:13
naestnecniv: 建議先把官方文件讀過至少tutorials吧,至少知道資 02/27 21:11
naestnecniv: 料夾結構怎麼放 02/27 21:11