From e2880b8429b456716b8e21af8d9448ff46d3f155 Mon Sep 17 00:00:00 2001 From: Romuald Brunet Date: Thu, 3 May 2018 13:35:35 +0200 Subject: [PATCH] templates_auto_reload workaround When jinja was already set up (by having some template filters for example), modify the jinja_env to it will take the modification into account. Otherwise this decorator doesn't do anything in that case --- flask/app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flask/app.py b/flask/app.py index 87c59003..f56f9c28 100644 --- a/flask/app.py +++ b/flask/app.py @@ -708,6 +708,11 @@ class Flask(_PackageBoundObject): def _set_templates_auto_reload(self, value): self.config['TEMPLATES_AUTO_RELOAD'] = value + # workaround to not create jinja_env if it has not been created + if 'jinja_env' in self.__dict__: + # if it was created, also modify the underlying (jinja) config + self.jinja_env.auto_reload = value + templates_auto_reload = property( _get_templates_auto_reload, _set_templates_auto_reload )