前提・実現したいこと
http://python.zombie-hunting-club.com/entry/2017/11/03/223503
こちらのサイト通りにflaskを動かしてみています。
3の'Hello'を表示するところまでは理解して実行もうまく行ったのですが、4に写ってhtmlを表示させようとすると、下の画像ような画面になります。
エラーの原因がわからないため、ご教授いただきたいです。
ディレクトリ構成
該当のソースコード
サイトのまま記入しています。
ターミナルに表示されるエラー
Last login: Fri Nov 8 13:27:51 on ttys000 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. (base) hiranohiroshidainoMacBook-Air:~ yudai$ cd desktop/work/flaskr_project (base) hiranohiroshidainoMacBook-Air:flaskr_project yudai$ python server.py * Serving Flask app "server" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger PIN: 216-702-687 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET / HTTP/1.1" 500 - Traceback (most recent call last): File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ return self.wsgi_app(environ, start_response) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/yudai/Desktop/work/flaskr_project/server.py", line 9, in index return render_template('index.html') File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/templating.py", line 138, in render_template ctx.app.jinja_env.get_or_select_template(template_name_or_list), File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/jinja2/environment.py", line 830, in get_template return self._load_template(name, self.make_globals(globals)) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/jinja2/environment.py", line 804, in _load_template template = self.loader.load(self, name, globals) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/jinja2/loaders.py", line 113, in load source, filename, uptodate = self.get_source(environment, name) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/templating.py", line 60, in get_source return self._get_source_fast(environment, template) File "/Users/yudai/opt/anaconda3/lib/python3.7/site-packages/flask/templating.py", line 89, in _get_source_fast raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: index.html 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 - 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 - 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 - 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 - 127.0.0.1 - - [08/Nov/2019 13:43:38] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 - 127.0.0.1 - - [08/Nov/2019 13:43:39] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
試したこと
自分で書いたことによって何かのミスがあるのかと思い、コピペしてみましたが、うまくいきませんでした。
回答1件
あなたの回答
tips
プレビュー