前提・実現したいこと
webページのログイン画面を作るためにFlaskを使ってPythonスクリプトを書いています。
そこで、render_templateを使ってtemplateディレクトリ内にあるindex.htmlを呼び出すところでなぜかエラーが発生します。
render_templateでindex.htmlを呼び出さずにreturn "Hello!"としていればブラウザ上にHello!と表示されるのですが、呼び出す形にするとブラウザ上にInternal Server Errorというエラーが出ます。
該当のソースコード
##hello.py #!/usr/bin/env python # -*- coding: utf-8 -*- from flask import Flask, render_template app = Flask(__name__) @app.route('/', methods=['GET']) def index(): return render_template ('index.html') if __name__ == '__main__': app.run(host='0.0.0.0')
#/template/index.html <!DOCTYPE html> <html> <head> <title>Hello</title> </head> <body> <h1>hello</h1> </body> </html>
試したこと
インデントも確認しました。
python hello.py でpythonを動かしたときはエラーが出ません。
何か思い当たる点がございましたら、教えていただけないでしょうか。
補足情報(FW/ツールのバージョンなど)
python3.6.5
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。