Failed to start gunicorn.service: Unit gunicorn.service not found

前端 未结 2 1935
一整个雨季
一整个雨季 2021-01-17 19:45

I am trying to deploy a basic application to Amazon EC2 using Django, Gunicorn, and Nginx. I have the app git c

相关标签:
2条回答
  • 2021-01-17 19:50

    Since Ubuntu 15.04 upstart has been replaced by systemd. You need to create a file /etc/systemd/gunicorn.service, which has a different syntax than the upstart file. The FAQ can get you started, and the reference is man systemd.service.

    0 讨论(0)
  • 2021-01-17 20:04

    Adding to Antonis Christofides answer:

    1) Open and create systemd service file:

    $ sudo nano /etc/systemd/system/gunicorn.service
    

    2) Write the following content to the file:

    [Unit]
    Description=gunicorn daemon
    After=network.target
    
    [Service]
    User=name_of_user    
    Group=name_of_user   
    WorkingDirectory=/home/name_of_user/myproject
    ExecStart=/home/name_of_user/myproject/virtualenv_directory/bin/gunicorn -- 
    access-logfile - --workers 3 --bind unix:/home/name_of_user/myproject/myproject.sock myproject.wsgi:application
    
    [Install]
    WantedBy=multi-user.target
    

    3) Starting the service:

    $ sudo systemctl start gunicorn
    

    4) Enabling the service:

    $ sudo systemctl enable gunicorn
    

    5) Check the status of the process:

    $ sudo systemctl status gunicorn
    

    For more visit here

    Thanks. :)

    0 讨论(0)
提交回复
热议问题