【问题标题】:Deploying Django project on Centos 8, using Gunicorn, Nginx (Gunicorn.service problem)在 Centos 8 上部署 Django 项目,使用 Gunicorn、Nginx(Gunicorn.service 问题)
【发布时间】:2020-09-01 07:37:47
【问题描述】:

我按照本教程进行操作

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

  1. 试图在 centos 8 上部署 Django 项目
  2. 一切都很顺利,除了 gunicorn.service
    [Unit]
    Description=gunicorn daemon
    After=network.target
        
    [Service]
    User=facealatoo
    Group=nginx
    WorkingDirectory=/home/facealatoo/nadyr/promed
    ExecStart=/home/facealatoo/nadyr/promed/venv/bin/gunicorn \ 
        --workers 3 \
        --bind unix:/home/facealatoo/nadyr/promed/promed.sock \
        configs.wsgi:application

    [Install]
    WantedBy=multi-user.target

  1. 文件夹目的地

  2. 我的项目文件夹目的地'/home/facealatoo/nadyr/promed' settings.py 文件'home/facealatoo/nadyr/promed/ configs/settings.py'
  3. 服务器用户名'facealatoo'
  4. 运行后
    sudo systemctl daemon-reload
    sudo systemctl start gunicorn
    sudo systemctl enable gunicorn
    sudo systemctl status gunicorn.service  

错误信息

    ● gunicorn.service - gunicorn daemon
    Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor 
    preset: disabled)
    Active: failed (Result: exit-code) since Fri 2020-05-15 18:37:22 +06; 13s 
    ago
    Main PID: 32293 (code=exited, status=203/EXEC)
        
    May 15 18:37:22 facealatoo.net.kg systemd[1]: Started gunicorn daemon.
    May 15 18:37:22 facealatoo.net.kg systemd[1]: gunicorn.service: Main 
    process exited, code=exited, status=203/EXEC
    May 15 18:37:22 facealatoo.net.kg systemd[1]: gunicorn.service: Failed 
    with result 'exit-code'.

请帮帮我! ;) 提前致谢 ))))

【问题讨论】:

  • 你检查过这部分configs.wsgi:application吗?你的wsgi 在“/home/facealatoo/nadyr/promed/config”下吗?您如何在独立模式下运行您的应用程序,即仅使用 gunicorn 运行您的应用程序,您可以共享工作 cli 吗?
  • 是的,我的 wsgi 文件正好在 /home/facealatoo/nadyr/promed/configs 目录中,我已经通过将套接字文件目标更改为“facealatoo/”来解决这个问题。无论如何,非常感谢您的回复))))

标签: python django nginx gunicorn centos8


【解决方案1】:

我只是更改套接字文件目标(home/facealatoo(user)/)和 gunicorn 目标(usr/local/bin/gunicorn)。这些行动解决了我的问题)))

【讨论】:

    猜你喜欢
    • 2013-12-08
    • 2015-10-18
    • 2020-04-06
    • 2020-12-29
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    • 2017-04-13
    • 2015-06-02
    相关资源
    最近更新 更多