无法加载应用0(mountpoint ='')(未找到可调用或导入错误)

时间:2017-10-04 14:11:49

标签: linux nginx centos7 uwsgi

我在CentOS 7 Linux上使用nginx uWSGI Flask应用程序时出现以下错误:

unable to load app 0 (mountpoint='') (callable not found or import error)

我第一次使用Linux时跟随Digital Ocean tut,使用早期Centos版本的原始Udemy tut似乎没有用。我能够得到“Hello world'键入基本的Python文件在uwsgi和nginx之后运行tut,然后我看到有几个人有这个错误但看起来不同的解决方案。我在应用程序上方的父文件夹上递归更改了权限,因为我认为权限可能是错误的来源:

sudo chmod -R 771 www

并且还允许nginx访问我的用户组?正如Dig Ocean教程所建议的那样:

sudo usermod -a -G will nginx
chmod 710 /home/will

uwsgi.ini文件如下,其中/var/www/html/CON29Application1/Source/app.py是我要运行的应用程序,不确定模块行是否正确语法:

[uwsgi]

module = Source.app
master = true
socket = /var/www/html/CON29Application1/socket.sock
chmod-socket = 777
vacuum = true
processes = 8
threads = 8
harakiri = 15
logto = /var/www/html/CON29Application1/log/%n.log
die-on-term = true

Systemd文件位于/etc/systemd/system/CON29Application1.service:

[Unit]
Description=uWSGI instance to serve CON29Application1
After=network.target

[Service]
User=will
Group=nginx
WorkingDirectory=/var/www/html/CON29Application1
Environment="PATH=/var/www/html/CON29Application1/venv/bin"
ExecStart=/var/www/html/CON29Application1/venv/bin/uwsgi --ini uwsgi.ini

[Install]
WantedBy=multi-user.target

这是/etc/nginx/conf.d/default.conf中的default.conf文件(出于安全原因,本帖子中的服务器IP空白):

server {
        listen 80;
        server_name 188.xxx.xxx.xxx;

        location / {
                include uwsgi_params;
                uwsgi_pass unix:/var/www/html/CON29Application1/socket.sock;
                uwsgi_modifier1 30;
        }

        error_page 404  /404.html;
        location = /404.html {
                root /usr/share/nginx/html;
        }

        error_page 500 502 503 504      /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }
}

这是app.py文件:

from flask import Flask, render_template
...
app = Flask(__name__)
app.config.from_object('Source.config')

app.secret_key = "---------------------------------"
...

抱歉,因为我不确定哪些文件与include相关,所以这里也是完整的uwsgi.log文件!感谢您的任何想法:

*** Starting uWSGI 2.0.15 (64bit) on [Wed Oct  4 13:26:19 2017] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-16) on 02 October 2017 21:47:33
os: Linux-3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017
nodename: CON29Application1
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /var/www/html/CON29Application1
detected binary path: /var/www/html/CON29Application1/venv/bin/uwsgi
your processes number limit is 1792
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /var/www/html/CON29Application1/socket.sock fd 3
Python version: 3.6.2 (default, Sep 27 2017, 16:30:17)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
Python main interpreter initialized at 0x9acbd0
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 1304064 bytes (1273 KB) for 64 cores
*** Operational MODE: preforking+threaded ***
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 24254)
spawned uWSGI worker 1 (pid: 24259, cores: 8)
spawned uWSGI worker 2 (pid: 24260, cores: 8)
spawned uWSGI worker 3 (pid: 24261, cores: 8)
spawned uWSGI worker 4 (pid: 24262, cores: 8)
spawned uWSGI worker 5 (pid: 24263, cores: 8)
spawned uWSGI worker 6 (pid: 24264, cores: 8)
spawned uWSGI worker 7 (pid: 24265, cores: 8)
spawned uWSGI worker 8 (pid: 24266, cores: 8) 

0 个答案:

没有答案
相关问题