django Gunicorn 和 nginx 代理给出 504 错误
我浏览了所有相关问题但找不到答案,我也浏览了文档并尝试了所有我能做的,这是我的第一次,因此遇到了困难。 我有一个简单的 django polls 应用程序,具有正确的设置和静态文件,在本地工作。
正如标题中提到的,我尝试在新购买的 VPS 上使用 django,使用 nginx 和 Gunicorn,我也使用 virtualenv。
这是我在服务器上的文件夹结构: projhome 内的logs
pid
projhome
scripts
我有以下目录: bin
djangopolls
include
lib
local
正如已经提到的,与我拥有的 projhome 文件夹并行脚本文件夹,包含以下内容:
source /home/django/projhq/bin/activate
kill `cat /home/username/pid/gunicorn.pid`
gunicorn_django -c /home/username/projhome/djangopolls/gunicorn_cfg.py
现在要启动服务器,我需要转到脚本文件夹并运行启动脚本,我这样做没有任何错误,但是当我检查 IP
时,我得到 504错误。
我哪里错了???
I went through all the related questions and could not find the answer, i went through the docs as well and tried all that i could, its my first time, hence having a hard time.
I have a simple django polls app
with proper settings and static files, working locally.
As mentioned in the title i am trying to use django on a newly bought VPS, with nginx and gunicorn, i am using virtualenv as well.
Here is my folder structure on the server:logs
pid
projhome
scripts
inside the projhome i have the following directories:bin
djangopolls
include
lib
local
as already mentioned parallel to the projhome folder i have scripts folder, with the following content:
source /home/django/projhq/bin/activate
kill `cat /home/username/pid/gunicorn.pid`
gunicorn_django -c /home/username/projhome/djangopolls/gunicorn_cfg.py
Now to start the server i need to go to the scripts folder and run the start script, i do that without any error, but when i check the IP
i get 504 error.
Where am i wrong???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能首先需要 cd 进入 settings.py 文件所在的目录,然后运行 Gunicorn,这样您就可以更新 script.sh 以首先 cd 进入 django 项目目录。
you might first want to cd into the directory where settings.py file is placed and then run gunicorn, so you can update your script.sh to first cd into the django project directory.