Please help with creating gunicorn systemd Service File

Posted October 9, 2019 9.4k views

For a while I am struggling with putting my django website into production (and it drives me insane). After trying bunch of different tutorials now I am trying this one:

I am stuck on step where I have to configure Gunicorn systemd Service File, but since my project structured a bit different than in the tutorial I can’t find a way to correctly do it. Please help me find a way for it. For this project user named: gdmin and the directories are:

skdir/myenv/ - for virtual enviroment
skdir/STV_skaiciuokle/skaiciuokle_web - in here is held
skdir/STV_skaiciuokle/skaiciuokle_we/skaiciuokle_web - in here and are held.

My current gunicorn.service configured like this (not working):

Description=gunicorn daemon

ExecStart=/home/gdmin/skdir/myenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/gdmin/skdir/STV_skaiciuokle/skaiciuokle_web/skaiciuokle_web.sock skaiciuokle_web.wsgi:application


How to correctly configure it?

P.S. I am sorry (once again) for not formatting everything since I get formatting tool to work on chrome. How do I fix it?

edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


The configuration looks correct, what are the errors that you get when you try to start/restart the service?

Also does the socket file actually exist at /home/gdmin/skdir/STV_skaiciuokle/skaiciuokle_web/skaiciuokle_web.sock?


Finally got it running. For this project I ended up using Ubuntu 16.04 as tutorial suggested.

Problem was that socket file was not being created. During my research I noticed that files were not present since then I uploaded my project to github it discarded them as empty and unnecessary. I fixed this and it seems that was the root of my problem in the first place. After this I finally got site up and running.