flaskを使って開発をしていて、以下のようなディレクトリ構造を作りました。(一部割愛)
project/ ├── app/ │ ├── models/ │ │ └── index.py │ │ │ ├── templetes/ │ │ └── index.html
modelsのディレクトリから「python index.py」を実行して、tempaltes/index.htmlを画面に出したいと思っています。
python
1from flask import * 2 3app = Flask(__name__) 4 5@app.route("/") 6def index(): 7 return render_template("../templates/index.html") 8 9if __name__ == "__main__": 10 app.run()
以上のような書き方をしているのですが、ブラウザで確認しようとすると、
jinja2.exceptions.TemplateNotFound: ../templates/index.html
というエラーが出ます。
render_templateの使い方がまちがえているのでしょうか?
どなたかご教示ください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/26 00:15
2019/05/26 00:31
2019/05/26 01:39
2019/05/26 01:46
2019/05/26 01:55
2019/05/26 02:14
2019/05/26 03:26