Django + fastcgi + nginx日志记录

时间:2017-12-23 08:34:34

标签: django windows nginx

我从另一位开发者那里获得了django项目。它基于Windows服务器(Django + fastcgi + nginx)。 在settings.py中,当前选项DEBUG = True,但任何错误日志文件都不包含调试信息 的 nginx.conf

worker_processes  auto;
error_log  C:/PATH_TO_PROJECT/nginx/logs/error.log;
error_log  C:/PATH_TO_PROJECT/nginx/logs/error.log  notice;
error_log  C:/PATH_TO_PROJECT/nginx/logs/error.log  info;
error_log  C:/PATH_TO_PROJECT/nginx/logs/error.log  error;

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       8080;
        server_name  localhost;
        client_max_body_size    32m;
        error_log    C:/PATH_TO_PROJECT/nginx/logs/db-rlocalhost.error_log;
        error_log    C:/PATH_TO_PROJECT/nginx/logs/db-rlocalhost.error_log notice;
        error_log    C:/PATH_TO_PROJECT/nginx/logs/db-rlocalhost.error_log info;
        error_log    C:/PATH_TO_PROJECT/nginx/logs/db-rlocalhost.error_log error;

        location / {    
            fastcgi_pass 127.0.0.1:8888;
            fastcgi_pass_header Authorization; 
            fastcgi_hide_header X-Accel-Redirect;
            fastcgi_hide_header X-Sendfile;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors    off;
            fastcgi_param       CONTENT_LENGTH  $content_length;
            fastcgi_param       CONTENT_TYPE    $content_type;
            fastcgi_param       PATH_INFO       $fastcgi_script_name;
            fastcgi_param       QUERY_STRING    $query_string;
            fastcgi_param       REMOTE_ADDR     $remote_addr;
            fastcgi_param       REQUEST_METHOD  $request_method;
            fastcgi_param       REQUEST_URI     $request_uri;
            fastcgi_param       SERVER_NAME     $server_name;
            fastcgi_param       SERVER_PORT     $server_port;
            fastcgi_param       SERVER_PROTOCOL $server_protocol;
        }
        location /media/  {
            alias H:/AUCTION/;
        }
        location  /static/ {
            alias  C:/PATH_TO_PROJECT/static/;
        }
        location  /static_ac_invoice/ {
            alias  C:/PATH_TO_PROJECT/tender/ac_invoice/static/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

正在运行服务器

c:\PATH_TO_PROJECT\Scripts\python.exe c:\PATH_TO_PROJECT\tender\manage.py runfcgi method=threaded host=127.0.0.1 port=8888
C:\PATH_TO_PROJECT\nginx\nginx.exe

如何在没有重新配置项目的情况下获取调试信息以便在非fastcgi模式下运行?

1 个答案:

答案 0 :(得分:0)

python manage.py runfcgi method=threaded host=127.0.0.1 port=8888 daemonize=false

现在我可以看到调试信息。

为什么帮助输出manage.py中没有键daemonize = false?