我正在尝试通过这些教程http://senko.net/en/django-nginx-gunicorn/和http://honza.ca/2011/05/deploying-django-with-nginx使用 nginx 和 gunicorn 设置 django -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
有人可以指导我吗?谢谢!