Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a live reload like GAE with FALCON?

I am setting up a new project that is going to use python to build a RESTful back end. I looked at GAE, but choose Falcon Framework, because the application needs to eventually be installed on local servers. GAE has a great development feature, it allows for iterative development by watching the source, and reloading.

You can leave the web server running while you develop your application. The web server knows to watch for changes in your source files and reload them if necessary.

How can I set up Falcon to do the same thing?

like image 801
nycynik Avatar asked Feb 08 '23 19:02

nycynik


2 Answers

This may not be the best answer, but I found that there is no simple method that does not require more software installed the way GAE does it, but after you install gunicorn, your can use the --reload switch and the server will auto-reload the source.

$ gunicorn -b 127.0.0.1:8000 -b [::1]:8000 --reload myapp:app

Docs: http://docs.gunicorn.org/en/19.0/settings.html#reload

like image 138
nycynik Avatar answered Feb 16 '23 02:02

nycynik


Auto-reloading is not a feature of the framework (Falcon), but rather of the server. If you do want auto-reloading, the simplest way to do it is run your Falcon code on a gunicorn server, using the --reload switch. For example:

$ gunicorn --reload app:app

Assuming your API is inside app.py and named app.

like image 31
Trapsilo Bumi Avatar answered Feb 16 '23 02:02

Trapsilo Bumi