码迷,mamicode.com
首页 > 其他好文 > 详细

[django]用fastcgi部署

时间:2015-04-03 11:22:41      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:python   fastcgi   django   部署   

django官方已经开始弃用fastcgi来部署django应用了,作为以前使用过的用户,还是贴一个配置,用来做纪念吧。。

项目下

#! /bin/sh
case   "$@"   in
    start)
        python manage.py runfcgi host=127.0.0.1 port=8400
        ;;
    stop)
        kill -9 `ps aux|grep runfcgi|grep 8400|awk ‘{print $2}‘|xargs`
        ;;
    restart)
        kill -9 `ps aux|grep runfcgi|grep 8400|awk ‘{print $2}‘|xargs`
        sleep 1
        python manage.py runfcgi host=127.0.0.1 port=8400
        ;;
    *)
        echo ‘unknown arguments‘
        exit 1
        ;;
esac

nginx 配置

server {
    listen 80;
    server_name 127.0.0.1;
    access_log /var/log/nginx/vsite.access_log;
    error_log /var/log/nginx/vsite.error_log;
        location ^~/media {
        alias /data/test/vsite/staticfiles;
    }
    location ^~/upload {
        alias /data/test/vsite/uploadfiles;
    }
    location ^~/static {
        alias /data/test/vsite/staticfiles;
    }
        location / {
            # host and port to fastcgi server
            fastcgi_pass 127.0.0.1:8401;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
            fastcgi_param REMOTE_ADDR $remote_addr;
            fastcgi_param  SERVER_ADDR        $server_addr;
            fastcgi_param  SERVER_PORT        $server_port;
            fastcgi_param  SERVER_NAME        $server_name;
            fastcgi_param SERVER_PROTOCOL $server_protocol;
       }
}

声明:
本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/44851755
作者orangleliu 采用署名-非商业性使用-相同方式共享协议

[django]用fastcgi部署

标签:python   fastcgi   django   部署   

原文地址:http://blog.csdn.net/orangleliu/article/details/44851755

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!