diff --git a/gunicorn_start.sh b/gunicorn_start.sh index 9669644fa..5d82418df 100755 --- a/gunicorn_start.sh +++ b/gunicorn_start.sh @@ -23,6 +23,15 @@ DJANGO_WSGI_MODULE=sapl.wsgi # WSGI module name (*) echo "Starting $NAME as `whoami` on base dir $SAPL_DIR" +# parameter can be passed to run without virtualenv +if [[ "$@" != "no-venv" ]]; then + # Activate the virtual environment + cd $DJANGODIR + source /var/interlegis/.virtualenvs/sapl/bin/activate + export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE + export PYTHONPATH=$DJANGODIR:$PYTHONPATH +fi + # Create the run directory if it doesn't exist RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR diff --git a/start.sh b/start.sh index 226c70de4..0774b0e02 100755 --- a/start.sh +++ b/start.sh @@ -50,4 +50,4 @@ python3 manage.py migrate python3 manage.py collectstatic --no-input python3 manage.py rebuild_index --noinput -/bin/sh gunicorn_start.sh +/bin/sh gunicorn_start.sh no-venv