我正在开发一个django项目,我正在实例化(液滴)中的数字海洋服务器中执行这个项目,在其中创建(通过选择一个项) ubuntu服务器14.04 + django。
到目前为止还不错,但是当使用virtualenv配置实例时,如文档中所说的,http://gunicorn-docs.readthedocs.org/en/latest/deploy.html#using-virtualenv是不被识别的,因为在安装应用程序时(使用pip安装程序),例如"django框架rest“,这是不被识别的,并且会抛出500个错误,因为没有这样的应用程序。
我还看到了这个帖子https://www.digitalocean.com/community/questions/usinv-virtualenv-in-django-image,其中提到了配置文件的修改,您必须在配置文件中分配在虚拟服务器中创建的新gunicorn的地址,但是在重新启动服务时,它会抛出一个错误502: //
/* structure directory*/
/home/django
/myproject (django)
/envs/myapp (virtualenvs)
/* Gunicorn file */
description "Gunicorn daemon for Django project"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]
respawn
setuid django
setgid django
chdir /home/django
exec gunicorn \ (**Here is where you change the url and gave 502 error)
--name=myproject \
--pythonpath=myproject \
--bind=0.0.0.0:9000 \
--config /etc/gunicorn.d/gunicorn.py \
conf.wsgi:application不知道为什么会这样?有人在这种情况下可以帮助我解决这个问题。
发布于 2014-12-03 13:58:02
我不明白你对URL的意思,virtualenv和URL没有任何关系。链接到的答案为您提供了解决方案:您需要使用exec /path/to/my/virtualenv/bin/gunicorn ...显式启动安装在虚拟环境中的gunicorn。
https://stackoverflow.com/questions/27272200
复制相似问题