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

设置:

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/

10-13 09:19