Error during starting Gunicorn: "Worker failed to boot"

I'm trying to deploy a Django project to DigitalOcean with Gunicorn and Nginx.

When I try to start Gunicorn I'm getting the error: "Worker failed to boot"

cd /opt/blog/src && /opt/blog/env/bin/gunicorn core.wsgi:application --bind 0.0.0.0:8000

The error:

gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

This is my project structure:

/opt/blog/
    env/
    src/
        core/
            wsgi.py

In my settings.py:

DEBUG=False
ALLOWED_HOSTS = ['*']

/etc/init/gunicorn.conf:

description "Gunicorn application server handling blog."

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid nobody
setgid nogroup
chdir /opt/blog/src

exec /opt/blog/env/bin/gunicorn --workers 3 --bind 0.0.0.0:8000 core.wsgi:application

/etc/nginx/sites-available/umutcoskun.com:

server {
    server_name umutcoskun.com www.umutcoskun.com;

    access_log off;

    location /static/ {
        alias /opt/blog/static/;
    }

    location / {
        proxy_pass http://0.0.0.0:8000;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $proxy_add_x_forwarded_for;
        add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
    }
}

Where am I making mistakes?

Upvotes: 0

Views: 1171

Answers (1)

When I run gunicorn command with "--preload", I get this error:

ValueError: Unable to configure root logger: Unable to add handler 'sentry': 'sentry'"

Then I removed sentry from logger handlers in my settings.py. Then error fixed.

Upvotes: 3

Related Questions