Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django生产中Gunicorn的守护程序和Upscript之间的差异_Python_Linux_Django_Nginx_Gunicorn - Fatal编程技术网

Python Django生产中Gunicorn的守护程序和Upscript之间的差异

Python Django生产中Gunicorn的守护程序和Upscript之间的差异,python,linux,django,nginx,gunicorn,Python,Linux,Django,Nginx,Gunicorn,我正在生产中部署一个Django站点,从一周开始,无论我在Django虚拟环境中以及在location/home/Django/project/bin/Gunicorn新创建的用户djagno下做什么,我都无法在/etc/init/project.conf中获取Gunicorn脚本来绑定Nginx。我需要知道,我可以运行在生产与守护程序的网站。我知道daemon只是一个后台进程,没有连接到任何tty。但是,如果从virtualenv内部运行命令来创建一个pid,比如“gunicorn--bind

我正在生产中部署一个Django站点,从一周开始,无论我在Django虚拟环境中以及在location/home/Django/project/bin/Gunicorn新创建的用户djagno下做什么,我都无法在/etc/init/project.conf中获取Gunicorn脚本来绑定Nginx。我需要知道,我可以运行在生产与守护程序的网站。我知道daemon只是一个后台进程,没有连接到任何tty。但是,如果从virtualenv内部运行命令来创建一个pid,比如“gunicorn--bind 127.0.0.1:9500 project.wsgi:application--config=/etc/gunicorn.d/gunicorn.py--name=project-p/tmp/project.pid”,它就不会充当服务吗?我的没有虚拟环境的项目工作得很好,但没有虚拟环境。我正在学习Linux,所以需要专家的建议。我可以启动这样的项目吗

下面给出了我在virtualenv中无法附加的upstart脚本

description "Gunicorn daemon for Django project"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectadly trigger a respawn
respawn

setuid django
setgid django
chdir /home/django

exec gunicorn \
    --name=project\
    --pythonpath=project\
    --bind=127.0.0.1:9500 \
    --config /etc/gunicorn.d/gunicorn.py \
    project.wsgi:application

如果有人能帮助我根据virtualenv对其进行更改,我将不胜感激。再一次…对于我的没有virtualenv的项目来说,相同的设置工作得很好,但对于我的第二个网站来说却不行,唯一的区别是我运行的第一个没有virtualenv的项目和第二个来自virtualenv的项目

关键是,如果您只是这样运行它,您没有任何责任确保它保持运行:如果进程死亡,或者如果您必须重新启动服务器,您将不得不手动重新运行该命令。这就是upstart或supervisor将为您所做的:监视它是否确实在运行,如果它没有运行,则将其带回来


如果您需要调试upstart脚本的帮助,您需要实际发布它,以及日志中的任何错误。

关键是,如果您只是这样运行它,您没有任何责任确保它保持运行:如果进程死亡,或者如果您必须重新启动服务器,则必须手动重新运行该命令。这就是upstart或supervisor将为您所做的:监视它是否确实在运行,如果它没有运行,则将其带回来


如果您需要调试upstart脚本的帮助,您需要实际发布它,以及日志中的任何错误。

我已尝试在/var/upstart/gunicorn.log中查看详细信息,但对此项目没有太多帮助。我已经在上面的原始问题中粘贴了脚本。我尝试在/var/upstart/gunicorn.log中查看详细信息,但没有为该项目提供多少帮助。我已经在上面的原始问题中粘贴了脚本。