가장 간단한 방법은 당신이 uWSGI에 집착 할 필요가 없다면 Gunicorn을 사용할 것입니다. 훌륭한 문서가 있으며 배포가 쉽고 빠릅니다.
website_gunicorn.conf.py (장소 어디에서든지 당신이 좋아하는) :
import multiprocessing
daemon = False
bind = "unix:/tmp/gunicorn.sock"
workers = multiprocessing.cpu_count() * 2 + 1
timeout = 60
해당 Nginx에의 설정 (부분, 메인에 포함
나는이 작품과 같은 몇 가지 (제작 포함) 웹 사이트와 뭔가를 설정) :
upstream gunicorn {
server unix:/tmp/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name example.com;
access_log /var/log/access.log combined;
error_log /var/log/error.log error;
keepalive_timeout 5;
# path for static files
root /path/to/your/static/files;
location @django {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_ignore_client_abort off;
proxy_buffering off;
proxy_redirect off;
proxy_pass http://gunicorn;
proxy_read_timeout 60;
}
location/{
try_files $uri @django;
}
}
는 그런 다음 Gunicorn를 설치 한 후 물론 (이 같은 시작할 수 있어야 - pip install gunicorn
일) :
gunicorn_django -c /path/to/website_gunicorn.conf.py
및 NGINX는 소켓에 연결하여 웹 사이트를 제공해야합니다 (정적 파일은 NGINX에서 메모리를 절약하여 직접 제공됩니다).
자세한 내용은 Gunicorn 문서 deployment 및 configuration을 참조하십시오. Gunicorn 구성에 daemon=False
이 있습니다. 이는 내가 제어하기 위해 Supervisor을 사용하기 때문입니다. 당신은 그 라인을 없앨 수도 있고 싶지 않을 수도 있습니다.
출처
2012-09-08 10:44:08
kgr
을 게시 할 수 즐기 .. 장고 앱을 통해 uwsgi에 요청을 전달합니다 귀하의 nginx에 uwsgi.ini
이제 모든 요청 구성 파일? – j0nes
어떤 서버 OS를 사용하고 있습니까? nginx.conf, 사이트 사용 가능 파일 및 uWSGI 가사 구성을 돕기 위해 우리가 알아야 할 세 가지 중요한 파일이 있습니다. – aychedee
현재 내 시스템 (Ubuntu 12.04 LTS)에서 배포를 테스트 중입니다 –