Question

Issue with Service that i Created

Posted March 4, 2021 180 views
NginxUbuntuPythonPython FrameworksUbuntu 18.04

Having Issue with Service that i Created.

 gunicorn --bind 0.0.0.0:5000 wsgi:application  

This works well no issue at all.

But with the Service, I get an error.

[Unit]
Description=Gunicorn instance to serve lolf
Wants = network-online.target
After = network.target network-online.target

[Service]
User=lolfbwu1
Group=www-data
WorkingDirectory=/home/lolfbw/lolf
Environment="PATH=/home/lolfbw/lolf/lolfenv/bin"
ExecStart=/home/lolfbw/lolf/lolfenv/bin/gunicorn --workers 3 --bind unix:lolf.sock -m 007 wsgi

[Install]
WantedBy=multi-user.target

Error i am getting:

gunicorn[27945]:     final_start = datetime.fromisoformat(formated_start).timestamp()

gunicorn[27945]: ValueError: Invalid isoformat string: ' 00:00:00'

But I don’t get this error when running it as

>>  gunicorn --bind 0.0.0.0:5000 wsgi:application  

Any Idea why is that?

I am using Python3.9.

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
1 answer

Hi there,

I believe that it might be a problem with the Socket, I could suggest giving the full path to the socket.

Also have you tried using the Unit file from this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

Let me know how it goes.
Regards,
Bobby

by Justin Ellingwood
Django is a powerful web framework that can help you get your Python application or website off the ground. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server...
  • i tried that as well, didn’t help me out.

    • Hi there,

      Do you get the same error when using the exact same ExecStart line as per the tutorial?

      Regards,
      Bobby

      • ExecStart=/home/lolfbw/lolf/lolfenv/bin/gunicorn --workers 3 --bind unix:lolf.sock -m 007 wsgi:application
        
        ExecStart=/home/lolfbw/lolf/lolfenv/bin/gunicorn --workers 3 --bind unix:/home/lolfbw/lolf/lolf.sock -m 007 wsgi:application
        

        Getting same error with both.. Very Strange.

        • Hi there,

          Is your project open source? I could take a look at the code.

          As far as I can see the formated_start value is not being set correctly causing the service to crash.

          Regards,
          Bobby