生成uWSGI worker之后,django没有错误提示就无法运行

时间:2019-05-23 17:20:08

标签: django nginx centos uwsgi

我正在环境为django + uwsgi + nginx的centos服务器上运行python应用程序。 在我使用uwsgi --ini uwsgi.ini初始化uwsgi之后,Django没有在日志中没有错误提示的情况下运行。日志显示如下:

*** Starting uWSGI 2.0.17.1 (64bit) on [Fri May 24 00:41:29 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-16) on 14 January 2019 13:09:48
os: Linux-3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017
nodename: iz8vbbvd4vh19pkxsm09q0z
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/firstWeb
writing pidfile to uwsgi.pid
detected binary path: /root/anaconda3/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
chdir() to /home/firstWeb/
your processes number limit is 15088
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address :8000 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.7.0 (default, Jun 28 2018, 13:15:42)  [GCC 7.2.0]
Python main interpreter initialized at 0x2371680
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 218712 bytes (213 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x2371680 pid: 25768 (default app)
mountpoint  already configured. skip.
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 25768)
spawned uWSGI worker 1 (pid: 25771, cores: 1)
spawned uWSGI worker 2 (pid: 25773, cores: 1)

我的uwsgi设置:

[uwsgi]
# Django-related settings
socket = :8000
chdir = /home/firstWeb/
wsgi-file = /firstWeb/wsgi.py
module =firstWeb.wsgi
# master
master = true
# maximum number of worker processes
processes = 2
# with appropriate permissions - may be needed
chmod-socket    = 666
# clear environment on exit
vacuum = true
pidfile=uwsgi.pid
daemonize=uwsgi.log
thunder-lock = true
# 运行uwsgi多线程
enable-threads = true

nginx设置:


user nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }  

}

如果django成功运行,则在生成部分之后应该有请求。但是没有,因此django没有成功运行。 我如何成功运行django? 千分感谢!

我将chomod-socket更改为666,但是它不起作用。

0 个答案:

没有答案