[Flask] Blueprints templates

Laura Morales lauretas at mail.com
Sun Mar 18 15:15:33 EDT 2018


> The Flask project has a main ‘templates’ folder. The convenience of
> blueprints it that the blueprint folder can have the same structure
> as the main templates folder.  When a view is rendered with
> `render_template()`, it will first look in the blueprint’s template
> folder for the specified template, if doesn’t find it, then it looks
> in the main template folder.

I think the documentation says the opposite. First it looks in the main templates folder, and if it doesn't find it then it looks inside the blueprints folders (from the first registered up to the last one). That's why they suggest to add this extra folder in your blueprints templates directory. And that's why I think it would be nice if Flask could automatically understand what blueprint I'm talking about without creating the extra folder.


More information about the Flask mailing list