unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.46k stars 692 forks source link

jinja2.exceptions.TemplateNotFound: index.html when it exists #2207

Closed caissalover closed 4 years ago

caissalover commented 4 years ago

I have made a flask python application which has index.html in the templates directory under root directory and myapp.py under root directory. Below is my ini configuration.

wsgi-file=myapp.py
callable=app
master=true
enable-threads=true
http=0.0.0.0:2727

When I execute "uwsgi --ini myapp.py" and "curl 0.0.0.0:2727" on another virtual terminal, I get

jinja2.exceptions.TemplateNotFound: index.html

When I run my app with "flask run" and curl __, I get my index.html markup

I also tried hosting webpage with "gunicorn myapp:app" and it works perfectly fine.

https://stackoverflow.com/questions/62814165/jinja2exceptions-templatenotfound-index-html-with-uwsgi-but-not-flask-run

xrmx commented 4 years ago

Looks like an application issue where you are using relative paths, use absolute ones.

caissalover commented 4 years ago

Thanks xrmx, setting template_folder to the path did it, but isn't it an error nevertheless. It should work with relative paths too right?