gunicorn autoreload on source change

前端 未结 4 1889
太阳男子
太阳男子 2020-11-28 06:00

Finally I migrated my development env from runserver to gunicorn/nginx.

It\'d be convenient to replicate the autoreload feature of runserver to gunicorn, so the serv

4条回答
  •  天命终不由人
    2020-11-28 06:23

    Bryan Helmig came up with this and I modified it to use run_gunicorn instead of launching gunicorn directly, to make it possible to just cut and paste these 3 commands into a shell in your django project root folder (with your virtualenv activated):

    pip install watchdog -U
    watchmedo shell-command --patterns="*.py;*.html;*.css;*.js" --recursive --command='echo "${watch_src_path}" && kill -HUP `cat gunicorn.pid`' . &
    python manage.py run_gunicorn 127.0.0.1:80 --pid=gunicorn.pid
    

提交回复
热议问题