Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it look to me that the project is not in the path of gunicorn.</p> <p>personally, I use <code>manage.py run_gunicorn</code> and i pass all the config args by command line and For the Path, I use virtualenv and I source the bin/activate in my shell scrpt</p> <p>this is my bash script :</p> <pre><code>#!/bin/sh ### BEGIN INIT INFO # Provides: myProject.exemple.com # Required-Start: $syslog $nginx # Required-Stop: $syslog $nginx # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: the django fast_cgi portal for myProject.exemple.com ### END INIT INFO # with this config : # the project is in /home/web/prod/myProject.exemple.com/src/myProject/ # the socket is in /var/run/django/myProject.sock # the log files is /val/log/nginx/myProject.exemple.com/gunicorn.log # the pid file is /var/run/django/myProject.pid # note, for debuging purpose, you can set a DEBUG env variable to prevent gunicorn to fork and to see all the output. # ie : sudo DEBUG=True /etc/init.d/django_myProject start if [ -f "/lib/lsb/init-functions-color"] ; then . /lib/lsb/init-functions-color else . /lib/lsb/init-functions fi # not exactly used by workon, but used to source the activate WORKON_HOME=/home/web/prod/Envs # change on eveny new project PROJECT_NAME=myProject DOMAINE=$PROJECT_NAME.exemple.com # fixed PIDFILE=/var/run/django/$PROJECT_NAME.pid LOGFILE=/var/log/nginx/$DOMAINE/gunicorn.log SOCKFILE=/var/run/django/$PROJECT_NAME.sock SOCKET=unix:$SOCKFILE #SOCKET=192.9.201.3:8050 #This is the command to be run, give the full pathname PROJECT_DIR=/home/web/prod/$DOMAINE/src/$PROJECT_NAME/ DAEMON="$PROJECT_DIR/manage.py run_gunicorn" USER=www-data GROUP=www-data WORKERS=2 # could be changed #DAEMON_OPTS="run_gunicorn --workers 1 \ # --worker-connections 5 \ # --daemon\ # --user www-data\ # --group www-data\ # -t 30\ # --bind unix:$SOCKET \ # --pid $PIDFILE \ # --error-logfile /var/log/nginx/$DOMAINE/gunicorn.log" # --daemon \ DEBUG_ARGS=" --user=$USER \ --group=$GROUP \ --workers=$WORKERS \ --bind $SOCKET \ -t 90 \ --settings=$PROJECT_NAME.settings.prod \ --name=$DOMAINE" DAEMON_OPTS=" $DEBUG_ARGS \ --pid=$PIDFILE \ --daemon \ --log-file=$LOGFILE \ --log-level=info" start() { cd "$PROJECT_DIR" log_begin_msg "starting django website" "$PROJECT_NAME" mkdir -p `dirname $SOCKFILE` chown www-data:www-data `dirname $SOCKFILE` # echo "$SOCKET" | grep '^unix:' &gt; /dev/null 2&gt; /dev/null # if [ ! -e "$SOCKFILE" -a "$?" -eq "0" ] # then # log_warning_msg "creation du socket $SOCKFILE" # # mkfifo $SOCKFILE # # fi if [ -f "$PIDFILE" ] then ps faux | grep -v grep | grep "$DAEMON" | grep `cat $PIDFILE` &gt; /dev/null if [ $? -eq 0 ] then log_failure_msg "fichier pid deja present avec un pid existant" log_end_msg 1 return 1 fi rm "$PIDFILE" log_warning_msg "pid file deja existant" fi if [ -f "$WORKON_HOME/$PROJECT_NAME/bin/activate" ]; then . $WORKON_HOME/$PROJECT_NAME/bin/activate else echo "impossible d'activer l'environement $WORKON_HOME/$PROJECT_NAME/bin/activate" exit 1 fi if [ ! -z "$DEBUG" ] ; then echo "sourcing $WORKON_HOME/$PROJECT_NAME/bin/activate" echo $DAEMON $DEBUG_ARGS $DAEMON $DEBUG_ARGS else $DAEMON $DAEMON_OPTS fi if [ $? -eq 0 ] then log_end_msg 0 else log_end_msg 1 fi } stop() { log_begin_msg "stoping django website" "$PROJECT_NAME" if [ -f "$PIDFILE" ] then start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE 2&gt; /dev/null rm "$PIDFILE" log_end_msg 0 else log_failure_msg "pid file absent for $PROJECT_NAME django website" #log_end_msg 1 fi } status() { if [ -f "$PIDFILE" ] then # fichier pid existant ps faux | grep -v grep | grep $DAEMON | grep `cat $PIDFILE` &gt; /dev/null if [ $? -eq 0 ] then echo "$PROJECT_NAME django website running" else echo "WARN !! pid file present but $PROJECT_NAME django website stopped" fi else ps faux | grep -v grep | grep $DAEMON &gt; /dev/null if [ $? -eq 0 ] then echo "WARN !! $PROJECT_NAME django website apear to be running but don't have a PID FILE" else echo "$PROJECT_NAME django website stopped" fi fi } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 2 start ;; status) status ;; *) echo "Usage: "$1" {start|stop|restart|status}" exit 1 esac exit 0 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload