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!










share|improve this question






















  • 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















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!










share|improve this question






















  • 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













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!










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 7 at 15:44









bla0009

2,74393161




2,74393161












  • 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


















  • 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
















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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()