Django Supervisord fastcgi config (supervisord.conf) - exits immediately

I am trying to write a supervisord.conf to start django fastcgi process. The only problem is when I execute the fastcgi command, it starts the fastcgi process and immediately appears in the supervisor as "EXITED". (This view hits the vantage point)

Is there a way the supervisor process can be aware that the django fastcgi process is indeed running, but that it is in the background? I've been digging all the supervisord config options, it seems like it should be possible (maybe it can somehow figure it out based on the pid file or something), but I'm a little lost in the documentation.

$ ./manage.py supervisor status
celerybeat                       RUNNING    pid 12575, uptime 0:01:17
celerycam                        RUNNING    pid 12573, uptime 0:01:17
celeryd                          RUNNING    pid 12572, uptime 0:01:17
django                           EXITED     Mar 13 07:57 PM
runserver                        RUNNING    pid 12574, uptime 0:01:17

      

NOTE. I am actually using django-supervisor to create my config file using variables in the Django context. For the purposes of this example, variables like {{PYTHON}} and {{settings.VIRTUALENV_ROOT}} are simply populated in the obvious way. It should function exactly like a regular supervisor.conf file.

Below is my supervisord.conf file.

$ more supervisord.conf 
[supervisord]
logfile={{ settings.VIRTUALENV_ROOT }}/log/supervisord-jj.log
logfile_maxbytes=50MB
logfile_backups=15
pidfile={{ settings.VIRTUALENV_ROOT }}/var/run/supervisord-jj.pid

[program:celeryd]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd  

[program:celerycam]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celerycam

[program:runserver]
{% if settings.DEBUG %}
exclude=false
{% else %}
exclude=true
{% endif %}

[program:django]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py runfcgi  
         method=threaded daemonize=true 
         outlog={{ settings.VIRTUALENV_ROOT }}/log/django-fcgi.log 
         socket={{ settings.VIRTUALENV_ROOT }}/var/run/django-run.socket 
         pidfile={{ settings.VIRTUALENV_ROOT }}/var/run/django.pid

[program:autoreload]
exclude=true

      

Thanks for reading. Any advice is greatly appreciated.

+3


source to share


1 answer


Try it without making django run like a daemon. For the supervisor docs :



Programs designed to run under a supervisor must not demonize themselves. Instead, they should work in the foreground. They should not disconnect from the terminal from which they are launched.

+4


source







All Articles