2

At one hosting company, they used to run python projects with fcgi. They had set it up so that when i changed django.fcgi file, which put django & my project on pythonpath, my project code was instantly recompiled.

Because of that a friend set up hosting for our shared project in his server using fastcgi. It has been set up and the python scripts execute as they should, but what we do not know is, how to set it up so that my project would be recompiled when my setup file has been changed.

Alan

Zayatzz
  • 159
  • 3
  • 12

1 Answers1

0

Are you using mod_fastcgi or mod_fcgid? Anyway, you should just kill the fastcgi process (or have the process commit "suicide"), and apache will respawn another one, loading the new file. I use mod_fastcgi, and this is what I see:

0> ps -ef | grep fcgi
www-data   687   683  0 09:39 ?        00:00:00 /usr/sbin/fcgi-pm -k start
www-data  1037   687  0 09:41 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py
www-data  1038  1037  0 09:41 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py
www-data  1039  1037  0 09:41 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py

0> sudo kill 1037

0> ps -ef | grep fcgi
www-data   687   683  0 09:39 ?        00:00:00 /usr/sbin/fcgi-pm -k start
www-data  1142   687  2 09:43 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py
www-data  1143  1142  0 09:43 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py
www-data  1144  1142  0 09:43 ?        00:00:00 /usr/bin/python /var/www/wsgi/fcgi.py

If you are using the external server, you have to restart the fastcgi server instead. This is official documentation for application reloading in fastcgi: http://www.fastcgi.com/docs/faq.html#application_reload

Dan Andreatta
  • 5,384
  • 2
  • 23
  • 14