2024-11-30T11:22:08.741869+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/helpers.py", line 14, in <module>
2024-11-30T11:22:08.741869+00:00 app[web.1]: from werkzeug.urls import url_quote
2024-11-30T11:22:08.741870+00:00 app[web.1]: ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/app/.heroku/python/lib/python3.9/site-packages/werkzeug/urls.py)
이 오류는 Flask
와 Werkzeug
의 버전 호환 문제로 발생하는 것 같습니다. Flask
버전을 2.0.3
으로 낮추고, Werkzeug
의 호환 가능한 버전을 명시적으로 지정해보겠습니다.
아래와 같이 requirements.txt
파일을 수정해 보겠습니다:
requirements.txt
파일을 수정하여 Flask
버전을 2.0.3
으로 낮추고 Werkzeug
버전을 명시했습니다. 이를 통해 호환성 문제를 해결할 수 있을 것으로 기대됩니다.
다시 Heroku에 배포하고 문제가 해결되는지 확인해 주세요. 추가적으로 도움이 필요하면 말씀해 주세요!
Flask==2.0.3
Werkzeug==2.0.3
pandas==1.4.3
numpy==1.23.1
matplotlib==3.5.2
yfinance==0.1.70
gunicorn==20.1.0
Jinja2==3.1.2
heroku 에 이거 수정했다고 처리하는 명령어는?
수정된 requirements.txt
파일을 Heroku에 반영하려면, 로컬 파일에서 변경한 후 다시 푸시해야 합니다. 터미널에서 다음 명령어들을 사용하세요:
- 변경 사항을 Git에 추가:
git add requirements.txt
변경 사항을 커밋:
git commit -m "Update Flask and Werkzeug versions for compatibility"
Heroku로 푸시:
git push heroku main
이렇게 하면 수정된 requirements.txt
가 Heroku에 반영됩니다.
``` PS C:\_Fractal Trail> heroku logs --tail
2024-11-30T11:28:52.092068+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:28:52.092068+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:28:52.092069+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:28:52.092069+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:28:52.092069+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:28:52.092072+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:28:52.092072+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:28:52.092072+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:28:52.092072+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:28:52.092073+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:28:52.092073+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:28:52.092073+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:28:52.092073+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:28:52.092073+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:28:52.092073+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:28:52.092074+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:28:52.092074+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:28:52.092612+00:00 app[web.1]: 10.1.50.30 - - [30/Nov/2024:11:28:52 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:28:52.092872+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=bb92d296-f393-4ba5-bf72-d41db18e484b fwd="222.98.167.222" dyno=web.1 connect=0ms service=1ms status=500 bytes=463 protocol=https
2024-11-30T11:32:11.000000+00:00 app[api]: Build started by user mlach31012@gmail.com
2024-11-30T11:32:48.234006+00:00 app[api]: Deploy 9e72111e by user mlach31012@gmail.com
2024-11-30T11:32:48.234006+00:00 app[api]: Release v5 created by user mlach31012@gmail.com
2024-11-30T11:32:48.596014+00:00 heroku[web.1]: Restarting
2024-11-30T11:32:48.599491+00:00 heroku[web.1]: State changed from up to starting
2024-11-30T11:32:49.197875+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2024-11-30T11:32:49.220576+00:00 app[web.1]: [2024-11-30 11:32:49 +0000] [17] [INFO] Worker exiting (pid: 17)
2024-11-30T11:32:49.220580+00:00 app[web.1]: [2024-11-30 11:32:49 +0000] [9] [INFO] Worker exiting (pid: 9)
2024-11-30T11:32:49.220585+00:00 app[web.1]: [2024-11-30 11:32:49 +0000] [2] [INFO] Handling signal: term
2024-11-30T11:32:49.421128+00:00 app[web.1]: [2024-11-30 11:32:49 +0000] [2] [INFO] Shutting down: Master
2024-11-30T11:32:49.479267+00:00 heroku[web.1]: Process exited with status 0
2024-11-30T11:32:52.243514+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2024-11-30T11:32:52.887619+00:00 app[web.1]: Python buildpack: Detected 512 MB available memory and 8 CPU cores.
2024-11-30T11:32:52.887700+00:00 app[web.1]: Python buildpack: Defaulting WEB_CONCURRENCY to 2 based on the available memory.
2024-11-30T11:32:53.147861+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Starting gunicorn 20.1.0
2024-11-30T11:32:53.148299+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Listening at: http://0.0.0.0:24046 (2)
2024-11-30T11:32:53.148302+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Using worker: sync
2024-11-30T11:32:53.150140+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [9] [INFO] Booting worker with pid: 9
2024-11-30T11:32:53.192883+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [17] [INFO] Booting worker with pid: 17
2024-11-30T11:32:53.818582+00:00 heroku[web.1]: State changed from starting to up
2024-11-30T11:33:05.000000+00:00 app[api]: Build succeeded
2024-11-30T11:33:12.523355+00:00 app[web.1]: [2024-11-30 11:33:12,522] ERROR in app: Exception on / [GET]
2024-11-30T11:33:12.523369+00:00 app[web.1]: Traceback (most recent call last):
2024-11-30T11:33:12.523371+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
2024-11-30T11:33:12.523371+00:00 app[web.1]: response = self.full_dispatch_request()
2024-11-30T11:33:12.523372+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
2024-11-30T11:33:12.523372+00:00 app[web.1]: rv = self.handle_user_exception(e)
2024-11-30T11:33:12.523373+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
2024-11-30T11:33:12.523373+00:00 app[web.1]: rv = self.dispatch_request()
2024-11-30T11:33:12.523373+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
2024-11-30T11:33:12.523374+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-11-30T11:33:12.523374+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:33:12.523374+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:33:12.523375+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:33:12.523376+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:33:12.523377+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:33:12.523377+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:33:12.523377+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:33:12.523378+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:33:12.523378+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:33:12.523378+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:33:12.523378+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:33:12.523379+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:33:12.523379+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:33:12.523379+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:33:12.523379+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:33:12.523379+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:33:12.523379+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:33:12.550775+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:12 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:12.551124+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=a191937c-1346-44c1-b5a9-9427861e9951 fwd="222.98.167.222" dyno=web.1 connect=0ms service=29ms status=500 bytes=463 protocol=https
2024-11-30T11:33:12.786318+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:12 +0000] "GET /favicon.ico HTTP/1.1" 404 232 "https://fractaltrail20241130-b723087de37d.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:12.786548+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=cf36f863-202b-4759-9e95-a67ee0f451c1 fwd="222.98.167.222" dyno=web.1 connect=0ms service=1ms status=404 bytes=393 protocol=https
2024-11-30T11:33:31.482980+00:00 app[web.1]: [2024-11-30 11:33:31,481] ERROR in app: Exception on / [GET]
2024-11-30T11:33:31.482990+00:00 app[web.1]: Traceback (most recent call last):
2024-11-30T11:33:31.482991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
2024-11-30T11:33:31.482991+00:00 app[web.1]: response = self.full_dispatch_request()
2024-11-30T11:33:31.482992+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
2024-11-30T11:33:31.482992+00:00 app[web.1]: rv = self.handle_user_exception(e)
2024-11-30T11:33:31.482993+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
2024-11-30T11:33:31.482993+00:00 app[web.1]: rv = self.dispatch_request()
2024-11-30T11:33:31.482993+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
2024-11-30T11:33:31.482994+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-11-30T11:33:31.482994+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:33:31.482994+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:33:31.482994+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:33:31.483001+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:33:31.483001+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:33:31.483002+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:33:31.483002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:33:31.483002+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:33:31.483003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:33:31.483003+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:33:31.483003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:33:31.483004+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:33:31.483004+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:33:31.483004+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:33:31.483005+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:33:31.483005+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:33:31.483005+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:33:31.517089+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:31 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:31.517299+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=ba79439c-ead8-4771-832f-3f6280dc2dc7 fwd="222.98.167.222" dyno=web.1 connect=0ms service=36ms status=500 bytes=463 protocol=https ```
오류 로그를 보면 index.html
템플릿 파일을 찾을 수 없다고 나옵니다. 이를 해결하기 위해 다음을 확인하고 처리해주세요:
- 템플릿 파일 경로 확인:
- 템플릿 파일은 Flask에서 보통
templates/
폴더에 있어야 합니다.index.html
파일이 해당 폴더에 있는지 확인하세요.
- 템플릿 파일은 Flask에서 보통
├── app.py
├── requirements.txt
├── Procfile
├── templates/
├── index.html
├── result.html
파일을 추가하거나 수정한 경우 Git에 반영:
- 파일 위치를 수정한 후 Git에 반영해야 합니다.
git add templates/index.html templates/result.html
git commit -m "Add index.html and result.html to templates directory"
git push heroku main
이렇게 하면 index.html
과 result.html
파일이 Heroku 서버에 업로드되어 오류가 해결될 것입니다. 추가로 도움이 필요하시면 언제든지 말씀해 주세요!
``` PS C:\_Fractal Trail> heroku logs --tail
2024-11-30T11:32:49.479267+00:00 heroku[web.1]: Process exited with status 0
2024-11-30T11:32:52.243514+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2024-11-30T11:32:52.887619+00:00 app[web.1]: Python buildpack: Detected 512 MB available memory and 8 CPU cores.
2024-11-30T11:32:52.887700+00:00 app[web.1]: Python buildpack: Defaulting WEB_CONCURRENCY to 2 based on the available memory.
2024-11-30T11:32:53.147861+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Starting gunicorn 20.1.0
2024-11-30T11:32:53.148299+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Listening at: http://0.0.0.0:24046 (2)
2024-11-30T11:32:53.148302+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [2] [INFO] Using worker: sync
2024-11-30T11:32:53.150140+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [9] [INFO] Booting worker with pid: 9
2024-11-30T11:32:53.192883+00:00 app[web.1]: [2024-11-30 11:32:53 +0000] [17] [INFO] Booting worker with pid: 17
2024-11-30T11:32:53.818582+00:00 heroku[web.1]: State changed from starting to up
2024-11-30T11:33:05.000000+00:00 app[api]: Build succeeded
2024-11-30T11:33:12.523355+00:00 app[web.1]: [2024-11-30 11:33:12,522] ERROR in app: Exception on / [GET]
2024-11-30T11:33:12.523369+00:00 app[web.1]: Traceback (most recent call last):
2024-11-30T11:33:12.523371+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
2024-11-30T11:33:12.523371+00:00 app[web.1]: response = self.full_dispatch_request()
2024-11-30T11:33:12.523372+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
2024-11-30T11:33:12.523372+00:00 app[web.1]: rv = self.handle_user_exception(e)
2024-11-30T11:33:12.523373+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
2024-11-30T11:33:12.523373+00:00 app[web.1]: rv = self.dispatch_request()
2024-11-30T11:33:12.523373+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
2024-11-30T11:33:12.523374+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-11-30T11:33:12.523374+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:33:12.523374+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:33:12.523375+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:33:12.523376+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:33:12.523377+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:33:12.523377+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:33:12.523377+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:33:12.523378+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:33:12.523378+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:33:12.523378+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:33:12.523378+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:33:12.523379+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:33:12.523379+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:33:12.523379+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:33:12.523379+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:33:12.523379+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:33:12.523379+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:33:12.550775+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:12 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:12.551124+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=a191937c-1346-44c1-b5a9-9427861e9951 fwd="222.98.167.222" dyno=web.1 connect=0ms service=29ms status=500 bytes=463 protocol=https
2024-11-30T11:33:12.786318+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:12 +0000] "GET /favicon.ico HTTP/1.1" 404 232 "https://fractaltrail20241130-b723087de37d.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:12.786548+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=cf36f863-202b-4759-9e95-a67ee0f451c1 fwd="222.98.167.222" dyno=web.1 connect=0ms service=1ms status=404 bytes=393 protocol=https
2024-11-30T11:33:31.482980+00:00 app[web.1]: [2024-11-30 11:33:31,481] ERROR in app: Exception on / [GET]
2024-11-30T11:33:31.482990+00:00 app[web.1]: Traceback (most recent call last):
2024-11-30T11:33:31.482991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
2024-11-30T11:33:31.482991+00:00 app[web.1]: response = self.full_dispatch_request()
2024-11-30T11:33:31.482992+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
2024-11-30T11:33:31.482992+00:00 app[web.1]: rv = self.handle_user_exception(e)
2024-11-30T11:33:31.482993+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
2024-11-30T11:33:31.482993+00:00 app[web.1]: rv = self.dispatch_request()
2024-11-30T11:33:31.482993+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
2024-11-30T11:33:31.482994+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-11-30T11:33:31.482994+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:33:31.482994+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:33:31.482994+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:33:31.483001+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:33:31.483001+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:33:31.483002+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:33:31.483002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:33:31.483002+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:33:31.483003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:33:31.483003+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:33:31.483003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:33:31.483004+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:33:31.483004+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:33:31.483004+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:33:31.483005+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:33:31.483005+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:33:31.483005+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:33:31.517089+00:00 app[web.1]: 10.1.44.209 - - [30/Nov/2024:11:33:31 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:33:31.517299+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=ba79439c-ead8-4771-832f-3f6280dc2dc7 fwd="222.98.167.222" dyno=web.1 connect=0ms service=36ms status=500 bytes=463 protocol=https
2024-11-30T11:42:39.959829+00:00 app[web.1]: [2024-11-30 11:42:39,959] ERROR in app: Exception on / [GET]
2024-11-30T11:42:39.959842+00:00 app[web.1]: Traceback (most recent call last):
2024-11-30T11:42:39.959843+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
2024-11-30T11:42:39.959844+00:00 app[web.1]: response = self.full_dispatch_request()
2024-11-30T11:42:39.959845+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
2024-11-30T11:42:39.959845+00:00 app[web.1]: rv = self.handle_user_exception(e)
2024-11-30T11:42:39.959845+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
2024-11-30T11:42:39.959846+00:00 app[web.1]: rv = self.dispatch_request()
2024-11-30T11:42:39.959846+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
2024-11-30T11:42:39.959847+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-11-30T11:42:39.959847+00:00 app[web.1]: File "/app/app.py", line 32, in index
2024-11-30T11:42:39.959847+00:00 app[web.1]: return render_template('index.html')
2024-11-30T11:42:39.959848+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template
2024-11-30T11:42:39.959849+00:00 app[web.1]: ctx.app.jinja_env.get_or_select_template(template_name_or_list),
2024-11-30T11:42:39.959850+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1081, in get_or_select_template
2024-11-30T11:42:39.959851+00:00 app[web.1]: return self.get_template(template_name_or_list, parent, globals)
2024-11-30T11:42:39.959851+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 1010, in get_template
2024-11-30T11:42:39.959851+00:00 app[web.1]: return self._load_template(name, globals)
2024-11-30T11:42:39.959851+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/environment.py", line 969, in _load_template
2024-11-30T11:42:39.959852+00:00 app[web.1]: template = self.loader.load(self, name, self.make_globals(globals))
2024-11-30T11:42:39.959852+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 126, in load
2024-11-30T11:42:39.959852+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2024-11-30T11:42:39.959853+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2024-11-30T11:42:39.959853+00:00 app[web.1]: return self._get_source_fast(environment, template)
2024-11-30T11:42:39.959853+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2024-11-30T11:42:39.959853+00:00 app[web.1]: raise TemplateNotFound(template)
2024-11-30T11:42:39.959854+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: index.html
2024-11-30T11:42:39.960435+00:00 app[web.1]: 10.1.36.128 - - [30/Nov/2024:11:42:39 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
2024-11-30T11:42:39.960610+00:00 heroku[router]: at=info method=GET path="/" host=fractaltrail20241130-b723087de37d.herokuapp.com request_id=80a7d7bb-8960-4cdd-9ca0-41fc5e4d6042 fwd="222.98.167.222" dyno=web.1 connect=0ms service=2ms status=500 bytes=463 protocol=https ```
오류 로그에 따르면 index.html
템플릿 파일을 찾지 못하고 있습니다. 이 문제를 해결하려면 다음을 확인하고 진행해 보세요.
index.html
파일의 위치 확인:index.html
파일은 Flask 애플리케이션에서 기본적으로templates
폴더 안에 있어야 합니다. 이 파일이 제대로 위치해 있는지 확인하세요.- 예를 들어, 프로젝트 구조는 다음과 같아야 합니다:
├── app.py ├── requirements.txt ├── Procfile ├── templates/ ├── index.html ├── result.html
templates
폴더 추가 및 파일 확인:- 만약
templates
폴더가 없다면 생성하고, 그 안에index.html
및result.html
파일을 추가하세요.
- 만약
- Git에 변경 사항 추가:
- 파일 위치를 수정한 후 변경 사항을 Git에 추가하고 Heroku에 다시 배포해야 합니다.
git add templates/index.html templates/result.html git commit -m "Add index.html and result.html to templates directory" git push heroku main
이렇게 하면 index.html
과 result.html
이 Heroku에 배포되며, 템플릿을 찾을 수 없는 오류를 해결할 수 있을 것입니다. 추가로 도움이 필요하시면 언제든지 알려주세요!
├── app.py
├── requirements.txt
├── Procfile
├── templates/
├── index.html
├── result.html
git add templates/index.html templates/result.html
git commit -m "Add index.html and result.html to templates directory"
git push heroku main
Git에서 apppy_good.py
파일이 삭제된 상태인데, 아직 커밋되지 않았기 때문에 오류가 발생하고 있습니다. 삭제 상태를 포함하여 변경 사항을 커밋하거나, 해당 파일을 복원해야 합니다.
PS C:\_Fractal Trail> git commit -m "Add index.html and result.html to templates directory"
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: apppy_good.py
no changes added to commit (use "git add" and/or "git commit -a")
삭제된 파일을 포함해 모든 변경 사항을 커밋하려면 다음 명령어를 사용하세요:
- 삭제 상태 포함하여 변경 사항 추가:
git add -A
커밋:
git commit -m "Add index.html and result.html to templates directory, remove unused file"
Heroku로 푸시:
git push heroku main
만약 apppy_good.py
파일을 복원하고 싶다면 다음 명령어를 사용하세요:
git restore apppy_good.py
그 후 git add
, git commit
, git push
를 진행하시면 됩니다.