Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i update flask templates without restarting the uwsgi instance?

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.

like image 411
Banuta Alin Alexandru Avatar asked Jan 10 '17 15:01

Banuta Alin Alexandru


1 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.

Source: http://flask.pocoo.org/docs/0.12/config/

like image 111
Piotr Dawidiuk Avatar answered Nov 15 '22 23:11

Piotr Dawidiuk