Gunicorn3 not starting with systemd
up vote
0
down vote
favorite
My systemd gunicorn3 configuration looks like this in /etc/systemd/system/gunicorn.service
[Unit]
Description=Gunicorn daemon for Django
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/betadmin/current
ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
My Django installation is located in: /home/django/betadmin/current
I have added aliases for pip3 and gunicorn3 in ~/.bash_aliases
alias python=python3
alias pip=pip3
alias gunicorn=gunicorn3
My nginx site configuration is located here: /etc/nginx/sites-enabled/django
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/betadmin/current/betadmin/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/betadmin/current/betadmin/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
If I run
sudo service gunicorn status
● gunicorn.service - Gunicorn daemon for Django
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-11-07 15:27:18 UTC; 16min ago
Process: 2783 ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application (code=exited, status=1/FAILURE)
Main PID: 2783 (code=exited, status=1/FAILURE)
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Service hold-off time over, scheduling restart.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Scheduled restart job, restart counter is at 5.
Nov 07 15:27:18 django-admin-panel systemd[1]: Stopped Gunicorn daemon for Django.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Start request repeated too quickly.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: Failed to start Gunicorn daemon for Django.
I am not sure what is the problem? Can anyone suggest? I am using Ubuntu 18.04 and I want to run Django using python3.
Thanks!
python django python-3.x gunicorn
add a comment |
up vote
0
down vote
favorite
My systemd gunicorn3 configuration looks like this in /etc/systemd/system/gunicorn.service
[Unit]
Description=Gunicorn daemon for Django
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/betadmin/current
ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
My Django installation is located in: /home/django/betadmin/current
I have added aliases for pip3 and gunicorn3 in ~/.bash_aliases
alias python=python3
alias pip=pip3
alias gunicorn=gunicorn3
My nginx site configuration is located here: /etc/nginx/sites-enabled/django
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/betadmin/current/betadmin/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/betadmin/current/betadmin/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
If I run
sudo service gunicorn status
● gunicorn.service - Gunicorn daemon for Django
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-11-07 15:27:18 UTC; 16min ago
Process: 2783 ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application (code=exited, status=1/FAILURE)
Main PID: 2783 (code=exited, status=1/FAILURE)
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Service hold-off time over, scheduling restart.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Scheduled restart job, restart counter is at 5.
Nov 07 15:27:18 django-admin-panel systemd[1]: Stopped Gunicorn daemon for Django.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Start request repeated too quickly.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: Failed to start Gunicorn daemon for Django.
I am not sure what is the problem? Can anyone suggest? I am using Ubuntu 18.04 and I want to run Django using python3.
Thanks!
python django python-3.x gunicorn
Have you tried to rungunicorn
command in shell? Does it work?
– sipp11
Nov 7 at 15:53
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)unix:/home/django/gunicorn.socket
properly for the bind
– Scott Skiles
Nov 7 at 16:18
@ScottSkiles permissions are okay for/home/django/
folder.gunicorn.socket
is created when gunicorn is working
– bla0009
Nov 7 at 17:23
@sipp11 if I rungunicorn betadmin.wsgi
it works.
– bla0009
Nov 7 at 17:30
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
My systemd gunicorn3 configuration looks like this in /etc/systemd/system/gunicorn.service
[Unit]
Description=Gunicorn daemon for Django
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/betadmin/current
ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
My Django installation is located in: /home/django/betadmin/current
I have added aliases for pip3 and gunicorn3 in ~/.bash_aliases
alias python=python3
alias pip=pip3
alias gunicorn=gunicorn3
My nginx site configuration is located here: /etc/nginx/sites-enabled/django
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/betadmin/current/betadmin/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/betadmin/current/betadmin/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
If I run
sudo service gunicorn status
● gunicorn.service - Gunicorn daemon for Django
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-11-07 15:27:18 UTC; 16min ago
Process: 2783 ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application (code=exited, status=1/FAILURE)
Main PID: 2783 (code=exited, status=1/FAILURE)
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Service hold-off time over, scheduling restart.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Scheduled restart job, restart counter is at 5.
Nov 07 15:27:18 django-admin-panel systemd[1]: Stopped Gunicorn daemon for Django.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Start request repeated too quickly.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: Failed to start Gunicorn daemon for Django.
I am not sure what is the problem? Can anyone suggest? I am using Ubuntu 18.04 and I want to run Django using python3.
Thanks!
python django python-3.x gunicorn
My systemd gunicorn3 configuration looks like this in /etc/systemd/system/gunicorn.service
[Unit]
Description=Gunicorn daemon for Django
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/betadmin/current
ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
My Django installation is located in: /home/django/betadmin/current
I have added aliases for pip3 and gunicorn3 in ~/.bash_aliases
alias python=python3
alias pip=pip3
alias gunicorn=gunicorn3
My nginx site configuration is located here: /etc/nginx/sites-enabled/django
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/betadmin/current/betadmin/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/betadmin/current/betadmin/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
If I run
sudo service gunicorn status
● gunicorn.service - Gunicorn daemon for Django
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-11-07 15:27:18 UTC; 16min ago
Process: 2783 ExecStart=/usr/bin/gunicorn --name=betadmin --pythonpath=/home/django/betadmin/current --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py betadmin.wsgi:application (code=exited, status=1/FAILURE)
Main PID: 2783 (code=exited, status=1/FAILURE)
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Service hold-off time over, scheduling restart.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Scheduled restart job, restart counter is at 5.
Nov 07 15:27:18 django-admin-panel systemd[1]: Stopped Gunicorn daemon for Django.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Start request repeated too quickly.
Nov 07 15:27:18 django-admin-panel systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Nov 07 15:27:18 django-admin-panel systemd[1]: Failed to start Gunicorn daemon for Django.
I am not sure what is the problem? Can anyone suggest? I am using Ubuntu 18.04 and I want to run Django using python3.
Thanks!
python django python-3.x gunicorn
python django python-3.x gunicorn
asked Nov 7 at 15:44
bla0009
2,74393161
2,74393161
Have you tried to rungunicorn
command in shell? Does it work?
– sipp11
Nov 7 at 15:53
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)unix:/home/django/gunicorn.socket
properly for the bind
– Scott Skiles
Nov 7 at 16:18
@ScottSkiles permissions are okay for/home/django/
folder.gunicorn.socket
is created when gunicorn is working
– bla0009
Nov 7 at 17:23
@sipp11 if I rungunicorn betadmin.wsgi
it works.
– bla0009
Nov 7 at 17:30
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43
add a comment |
Have you tried to rungunicorn
command in shell? Does it work?
– sipp11
Nov 7 at 15:53
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)unix:/home/django/gunicorn.socket
properly for the bind
– Scott Skiles
Nov 7 at 16:18
@ScottSkiles permissions are okay for/home/django/
folder.gunicorn.socket
is created when gunicorn is working
– bla0009
Nov 7 at 17:23
@sipp11 if I rungunicorn betadmin.wsgi
it works.
– bla0009
Nov 7 at 17:30
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43
Have you tried to run
gunicorn
command in shell? Does it work?– sipp11
Nov 7 at 15:53
Have you tried to run
gunicorn
command in shell? Does it work?– sipp11
Nov 7 at 15:53
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)
unix:/home/django/gunicorn.socket
properly for the bind– Scott Skiles
Nov 7 at 16:18
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)
unix:/home/django/gunicorn.socket
properly for the bind– Scott Skiles
Nov 7 at 16:18
@ScottSkiles permissions are okay for
/home/django/
folder. gunicorn.socket
is created when gunicorn is working– bla0009
Nov 7 at 17:23
@ScottSkiles permissions are okay for
/home/django/
folder. gunicorn.socket
is created when gunicorn is working– bla0009
Nov 7 at 17:23
@sipp11 if I run
gunicorn betadmin.wsgi
it works.– bla0009
Nov 7 at 17:30
@sipp11 if I run
gunicorn betadmin.wsgi
it works.– bla0009
Nov 7 at 17:30
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53192875%2fgunicorn3-not-starting-with-systemd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried to run
gunicorn
command in shell? Does it work?– sipp11
Nov 7 at 15:53
Why is your working directory the same as the python directory? Isn't that weird? Also, make sure you have permissioned (chmod)
unix:/home/django/gunicorn.socket
properly for the bind– Scott Skiles
Nov 7 at 16:18
@ScottSkiles permissions are okay for
/home/django/
folder.gunicorn.socket
is created when gunicorn is working– bla0009
Nov 7 at 17:23
@sipp11 if I run
gunicorn betadmin.wsgi
it works.– bla0009
Nov 7 at 17:30
@sipp11 - I'd recommend adding options to the command line until it fails and you can pinpoint the source of the problem.
– Scott Skiles
Nov 7 at 17:43