7

When i run this command

[jenia@arch app]../bin/gunicorn zones.wsgi:application --bind localht:8000

The gunicorn server runs at localhost:8000. It doesnt return anything to the console as I assume it should. Just runs silently.

When I run my script in bin/gunicorn_start the server still runs silently and features odd behaviour. If I input an address that django can't resolve it gives me internal server error and that's it. no stack trace no nothing.

This is the bin/gunicorn_start script:

#!/bin/bash

NAME="hello_app" # Name of the application
DJANGODIR=/srv/http/proj05/app # Django project directory
SOCKFILE=/srv/http/proj05/app/run/gunicorn.sock # we will communicte using this unix socket
USER=jenia # the user to run as
GROUP=jenia # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=zones.settings # which settings file should Django use
DJANGO_WSGI_MODULE=zones.wsgi # WSGI module name

echo "Starting $NAME as `whoami`"

# Activate the virtual environment
cd $DJANGODIR
source activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH


# Create the run directory if it doesn't exist
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR



# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
echo "about to exec exec is" $DJANGO_WSGI_MODULE
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE

By the way, I created a virtualen at by doing:

cd proj05
virtualenv .
source bin/activate
pip install django
pip install gunicorn
...

Can anyone tell me how to make gunicorn output the debug information instead of just internal server error?

Thanks in advance.

Jenia Ivanov
  • 2,485
  • 3
  • 41
  • 69

3 Answers3

20

gunicorn doesn't return to the console by default now. Use the option --log-file=- to do it.

Also the error should be fixed in https://github.com/benoitc/gunicorn/issues/785 .

I will make a release tomorrow.

benoitc
  • 201
  • 1
  • 2
9

I was able to fix this problem by reverting back to Gunicorn 18.0.0.

pip uninstall gunicorn
pip install gunicorn==18.0.0

Not the ideal solution. Perhaps it's worth making a bug ticket about this problem. My concern is that I can't actually identify what the problem is...so how do I make a proper bug ticket? haha

Rico
  • 5,692
  • 8
  • 46
  • 63
5

You should use --log-file=- option

For more information see: http://gunicorn-docs.readthedocs.org/en/latest/faq.html#why-i-don-t-see-any-logs-in-the-console

Nemanja Trifunovic
  • 3,017
  • 1
  • 17
  • 20