Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up autoreload with Flask+uWSGI?

I am looking for something like uWSGI + django autoreload mode for Flask.

like image 821
Florian Avatar asked Jan 12 '12 07:01

Florian


People also ask

What is lazy apps in uWSGI?

Remember: lazy-apps is different from lazy, the first one only instructs uWSGI to load the application one time per worker, while the second is more invasive (and generally discouraged) as it changes a lot of internal defaults.

What is uWSGI used for?

uWSGI is an open source software application that "aims at developing a full stack for building hosting services". It is named after the Web Server Gateway Interface (WSGI), which was the first plugin supported by the project. uWSGI is maintained by Italian based software company unbit.


4 Answers

I am running uwsgi version 1.9.5 and the option

uwsgi --py-autoreload 1

works great

like image 100
srossross Avatar answered Nov 09 '22 11:11

srossross


If you're configuring uwsgi with command arguments, pass --py-autoreload=1:

uwsgi --py-autoreload=1

If you're using a .ini file to configure uwsgi and using uwsgi --ini, add the following to your .ini file:

py-autoreload = 1
like image 41
Luke Taylor Avatar answered Nov 09 '22 11:11

Luke Taylor


For development environment you can try using --python-autoreload uwsgi's parameter. Looking at the source code it may work only in threaded mode (--enable-threads).

like image 14
Tagar Avatar answered Nov 09 '22 11:11

Tagar


You could try using supervisord as a manager for your Uwsgi app. It also has a watch function that auto-reloads a process when a file or folder has been "touched"/modified.

You will find a nice tutorial here: Flask+NginX+Uwsgi+Supervisord

like image 7
verrochio Avatar answered Nov 09 '22 10:11

verrochio