This one has been nagging at me for a while, so it was nice to finally get two it working the way I like. It ended up being really easy, you’ll need a spectacular little app called watchdog to go with gunicorn:
pip install watchdog -U # now there is a command called "watchmedo", you'll like it... # in terminal #1, run: gunicorn app:myapp --pid=gunicorn.pid # in terminal #2, run: watchmedo shell-command \ --patterns="*.py;*.html;*.css;*.js" \ --recursive \ --command='echo "${watch_src_path}" && kill -HUP `cat gunicorn.pid`' . |
You shouldn’t have a hard time understanding what it does, but it works.