danielrvt
danielrvt

Reputation: 10926

Supervisord manage fcgi and django

I've managed to set up supervisord with fastcgi on a django project of mine, the problem is that when I make mi program stop, the server keeps running somehow, and my page keeps online.

Here is my supervisord program directive:

[program:helloworld]
command=/var/www/django-projects/helloworld/run

Here is my "run" script:

#!/bin/bash

source /var/www/django-projects/helloworld/venv/bin/activate;
/var/www/django-projects/helloworld/manage.py runfcgi \
     daemonize=false \
     host=127.0.0.1 \
     port=8000;

All I want is a way to stop/start/restart this django project using supervisord, hope you can help me.

Upvotes: 0

Views: 417

Answers (1)

Density 21.5
Density 21.5

Reputation: 1930

Although I don't use fcgi I am almost sure that your problem lies with source /var/www/django-projects/helloworld/venv/bin/activate;

You shouldn't use source inside a supervisor start script, it changes the current shell and there is none with supervisord. Instead just change your path in the supervisord script:

directory = /var/www/django-projects/helloworld/
command = /var/www/django-projects/helloworld/manage.py runfcgi \
 daemonize=false \
 host=127.0.0.1 \
 port=8000;

See this answer and the virtualenv documentation on using the activate script .

Upvotes: 1

Related Questions