Django 1.7 使用 uwsgi + Nginx

nginx + uWSGI  部署 django

安装 uwsgi

pip install uwsgi

#需要事先安装好 pip

创建uwsgi配置文件 uwsgi.ini

[uwsgi]
chdir=/path/to/your/project
module=mysite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/yourproject.log

详细参数配置参考:http://uwsgi-docs.readthedocs.org/en/latest/Configuration.html

启动服务

uwsgi --ini uwsgi.ini

nginx 中配置

server {
        listen       80;
    #    listen       somename:80;
        server_name  somename.com;

        location / {
            root   html;
            index  index.html index.htm;
            uwsgi_pass   127.0.0.1:3001;
            include     uwsgi_params;
        }
    }

 

One thought on “Django 1.7 使用 uwsgi + Nginx”

发表评论

电子邮件地址不会被公开。 必填项已用*标注