2022年8月2日火曜日

Django: Apache (WSGIモジュール) を再起動しなくてもアプリケーション変更を反映させる方法

DjangoをApacheのWSGIで本番運用している場合、アプリケーションプログラムを変更した場合、いちいちApacheを再起動していました。面倒なので簡単に変更が反映される方法がないか調べたところ、

「wsgi.py を微修正して保存する」と変更が反映されることが分かりました。

これで少し楽になりました。

参考
Is it possible to reload the view without restarting Django? - Stack Overflow

https://stackoverflow.com/questions/9183114/is-it-possible-to-reload-the-view-without-restarting-django

If you are running a production server (nginx, apache, etc) and you want code-reload, then you need to add something to your wsgi module to detect code changes.

Code reloading with apache: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

Code reloading with uwsgi: http://projects.unbit.it/uwsgi/wiki/TipsAndTricks


If you are running Django as a WSGI application in daemon mode you just need to touch the wsgi.py for your site and it will reload the application next time there is a request. (So no need for any special options).

0 件のコメント:

コメントを投稿