How can i update flask templates without restarting the uwsgi instance?
Question:
I have a flask application using an uwsgi instance. This application runs some threads in background when a cron command starts. Is there a method for updating my template files without restarting the uwsgi service ?
Currently I’m waiting for my threads to stop and then reloading the uwsgi service.
Answers:
Enabling TEMPLATES_AUTO_RELOAD
works nicely:
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
Whether to check for modifications of the template source and reload
it automatically. By default the value is None which means that Flask
checks original file only in debug mode.
I have a flask application using an uwsgi instance. This application runs some threads in background when a cron command starts. Is there a method for updating my template files without restarting the uwsgi service ?
Currently I’m waiting for my threads to stop and then reloading the uwsgi service.
Enabling TEMPLATES_AUTO_RELOAD
works nicely:
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
Whether to check for modifications of the template source and reload
it automatically. By default the value is None which means that Flask
checks original file only in debug mode.