gpt4 book ai didi

python - django-nginx-gunicorn - 不工作

转载 作者:太空宇宙 更新时间:2023-11-03 12:09:34 25 4
gpt4 key购买 nike

我正在尝试通过这些教程使用 nginx 和 gunicorn 设置 django http://senko.net/en/django-nginx-gunicorn/http://honza.ca/2011/05/deploying-django-with-nginx-and-gunicorn

设置:

virtualenv --no-site-packages qlimp
cd qlimp
source bin/activate
pip install gunicorn django
django-admin.py startproject qlimp
cd qlimp
python manage.py runserver 0.0.0.0:8001

Gunicorn 设置与此处相同http://senko.net/en/django-nginx-gunicorn/

所做的更改(run.sh):

LOGFILE=/var/log/gunicorn/qlimp.log
USER=nirmal
GROUP=nirmal
cd /home/nirmal/qlimp/qlimp

Upstart也和上面链接里的教程一样

所做的更改:

exec /home/nirmal/qlimp/qlimp/run.sh

Nginx 设置:

server {
listen 80;
server_name qlimp.com;

access_log /home/nirmal/qlimp/log/access.log;
error_log /home/nirmal/qlimp/log/error.log;

location /static {
root /home/nirmal/qlimp/qlimp;
}

location / {
proxy_pass http://127.0.0.1:8888;
}

然后我重新启动了 nginx 并运行了 gunicorn 服务器:

sudo /etc/init.d/nginx restart
(qlimp) cd qlimp/qlimp
(qlimp) gunicorn_django -D -c run.sh

当我运行 gunicorn 服务器时,出现此错误:

Failed to read config file: run.sh
Traceback (most recent call last):
File "/home/nirmal/qlimp/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 65, in load_config
execfile(opts.config, cfg, cfg)
File "run.sh", line 3
LOGFILE=/var/log/gunicorn/qlimp.log
^
SyntaxError: invalid syntax

有人可以指导我吗?谢谢!

最佳答案

试试/etc/gunicorn.d 而不是你自己的 sh 文件

关于python - django-nginx-gunicorn - 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10672658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com