【发布时间】:2014-12-03 12:50:25
【问题描述】:
我正在开发一个 django 项目,我在 digitalocean 服务器中的实例化(droplet)中创建(通过选择一个项目)ubuntu 服务器 14.04 + django。
非常好,但是在使用 virtualenv 配置实例时 正如文件所说 http://gunicorn-docs.readthedocs.org/en/latest/deploy.html#using-virtualenv 无法识别 virtualenv,因为在安装应用程序(使用 pip 安装程序)时,例如“django framework rest”,由于没有这样的应用程序,因此无法识别并抛出 500 错误。
我也看到了这个帖子 https://www.digitalocean.com/community/questions/usinv-virtualenv-in-django-image 其中提到了配置文件的修改,您必须在其中分配在 virtualenv 中创建的新 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
不知道为什么会出现这种情况?遇到这种情况的人可以帮我解决这个问题。
【问题讨论】:
标签: python django virtualenv gunicorn digital-ocean