Tobias Feil
Tobias Feil

Reputation: 2696

Flask non-template HTML files included by Jinja

In my Flask application, I have one html file that holds some html and some js that semantically belongs together and cannot be used separately in a sensible way. I include this file in 2 of my html templates by using Jinja's {%include ... %}.

Now my first approach was to put this file in my templates folder. However, I never call render_template on this file, so it seems unapt to store it in that directory.

Another approach would be to put it into the static folder, since its content is indeed static. But then I don't know how to tell Jinja to look for it in a different directory, since all the files using Jinja are in the templates folder.

Is there a way to accomplish this with Jinja, or is there a better approach altogether?

Upvotes: 1

Views: 367

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599610

You're over-thinking this. If it's included by Jinja, then it's a template file and belongs in the templates directory.

Upvotes: 1

Related Questions