I've spent the past few hours trying to understand the issue in a Flask project I'm working on - it's functioning perfectly locally but Heroku is returning a 500 internal server error.
I looked into my application logs and was met with the following:
2021-06-17T06:18:31.163134+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/jinja2/loaders.py", line 125, in load
2021-06-17T06:18:31.163135+00:00 app[web.1]: source, filename, uptodate = self.get_source(environment, name)
2021-06-17T06:18:31.163135+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 59, in get_source
2021-06-17T06:18:31.163135+00:00 app[web.1]: return self._get_source_fast(environment, template)
2021-06-17T06:18:31.163136+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/templating.py", line 95, in _get_source_fast
2021-06-17T06:18:31.163136+00:00 app[web.1]: raise TemplateNotFound(template)
2021-06-17T06:18:31.163137+00:00 app[web.1]: jinja2.exceptions.TemplateNotFound: home.html
2021-06-17T06:18:31.164382+00:00 app[web.1]: 10.93.205.135 - - [17/Jun/2021:06:18:31 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
2021-06-17T06:18:31.164554+00:00 heroku[router]: at=info method=GET path="/" host=denotia.herokuapp.com request_id=153ad2a6-8d87-4b19-bb4d-3854778f6e2b fwd="182.69.203.95" dyno=web.1 connect=1ms service=4ms status=500 bytes=463 protocol=http
My app.py comprises of simple code that displays a very basic functional website (index.html):
#libraries
import os
import numpy as np
import flask
import pickle
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def home():
return render_template('home.html')
if __name__ == "__main__":
app.run(debug=True)
I'd really appreciate some help with said issue, thank you :')