Bryan Helmig

Co-founder of Zapier, speaker, musician and builder of things.

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
# in terminal #2, run:
watchmedo shell-command \
  --patterns="*.py;*.html;*.css;*.js" \
  --recursive \
  --command='echo "${watch_src_path}" && kill -HUP `cat`' .

You shouldn’t have a hard time understanding what it does, but it works.

Edit: gunicorn --reload is built in now!

Posted December 14, 2012 @ 6:12 pm under Tech, Uncategorized.