Flask: jinja2.exceptions.TemplateNotFound:

Created on 24 Sep 2019  路  1Comment  路  Source: pallets/flask

https://github.com/pallets/flask/blob/599f32c7a4012ae5988c2599344503cfddeb1a08/examples/tutorial/flaskr/auth.py#L81

I was following the tutorial and I got the exception jinja2.exceptions.TemplateNotFound: auth/register.html while rendering the register template.
Actual code: return render_template("auth/register.html")
Solution: return render_template("register.html")

Most helpful comment

The template should be in a folder called "auth" under the "templates" folder. This is shown in the tutorial:

https://flask.palletsprojects.com/en/1.1.x/tutorial/templates/#register

flaskr/templates/auth/register.html

and in the code:

https://github.com/pallets/flask/tree/599f32c7a4012ae5988c2599344503cfddeb1a08/examples/tutorial/flaskr/templates

>All comments

The template should be in a folder called "auth" under the "templates" folder. This is shown in the tutorial:

https://flask.palletsprojects.com/en/1.1.x/tutorial/templates/#register

flaskr/templates/auth/register.html

and in the code:

https://github.com/pallets/flask/tree/599f32c7a4012ae5988c2599344503cfddeb1a08/examples/tutorial/flaskr/templates

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maangulo12 picture maangulo12  路  4Comments

rochacbruno picture rochacbruno  路  3Comments

wadegilmer picture wadegilmer  路  4Comments

rkomorn picture rkomorn  路  3Comments

ghost picture ghost  路  3Comments