To run gunicorn in background you will need to use a process control system like Supervisord to manage gunicorn.
Deployment instructions with Supervisor and/or Runit are described here
For the part of problem where the apps are not detected, did you add gunicorn
to your INSTALLED_APPS
setting in django settings.py
? If not integration is decribed here
Edit:
Sample gunicorn management script for supervisor
#!/bin/bash
set -e
LOGFILE=/home/ubuntu/logs/gunicorn/x.log
LOGDIR=$(dirname $LOGFILE)
NUM_WORKERS=3
HOST=0.0.0.0:8000
# user/group to run as
USER=ubuntu
GROUP=ubuntu
cd ~/webapps/Z/
. ~/virtualenvs/production/bin/activate
test -d $LOGDIR || mkdir -p $LOGDIR
exec ~/virtualenvs/production/bin/gunicorn_django -b $HOST -w $NUM_WORKERS \
--user=$USER --group=$GROUP --log-level=debug \
--log-file=$LOGFILE 2>>$LOGFILE