1.运行环境(windows  python(2.7.3))

先安装python  下载地址:python-2.7.3.msi

安装django   下载地址:Django-1.6.5.tar.gz

安装nginx    下载地址:nginx-1.7.2.zip

安装flup   下载地址:flup-1.0.2.tar.gz

安装mssqlserver 驱动:pymssql-2.1.0.win32-py2.7.exe

配置服务器:

server {
  listen 91;
  server_name localhost;
  location / {
    root e:/cosen/report;#django项目的存储位置
    fastcgi_pass 192.168.1.50:8051; 
    fastcgi_pass_header Authorization;
    fastcgi_intercept_errors off;
    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_param SERVER_PORT $server_port;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_SOFTWARE "nginx";
    fastcgi_param GATEWAY_INTERFACE "CGI/1.1";
}
  location /static {
    alias E:/cosen/report/static;#静态文件的存储位置
    autoindex on;
  }
}

 

 

记住还要django项目的urls.py中加入:

from django.conf import settings
if settings.DEBUG is False:
  urlpatterns += patterns('',
  url(r'^static/(?P<path>.*)$',
  'django.views.static.serve',
  { 'document_root': "e:/cosen/report/static"}),
)

posted on 2014-06-30 16:51  andylau168  阅读(288)  评论(0编辑  收藏  举报