繁体   English   中英

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

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

我正在尝试让uwsgi与python一起使用,但是nomatter我所做的无法加载我的应用程序。

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

uwsgi.ini:

[uwsgi]
http = 0.0.0.0:8000
module = uwsgi
callable = application

uwsgi.py:

def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return ["Hello!"]

目录结构是这样的:

/config/
.... __init__.py
.... uwsgi.ini
.... uwsgi.py

我不知道出什么问题了。 我已经浏览过该站点上的几个示例,文章和答案,但没有任何事情可以为我解决问题。.我尝试了命令行初始化并调用.ini,我不知所措,uwsgi似乎找到了uwsgi.py,因为我没有收到模块未找到错误,但是由于某种原因它无法加载。 精简的命令行init是以下命令:

uwsgi --ini uwsgi.ini

但我尝试了几种变体,尽管显然没有一种奏效。

这是全部错误:

[uWSGI] getting INI configuration from /config/uwsgi.ini
*** Starting uWSGI 2.0.14 (64bit) on [Mon Feb 27 08:40:38 2017] ***
compiled with version: 4.9.2 on 26 February 2017 23:44:57
os: Linux-4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017
nodename: fe627d90246e
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /config
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:8000 fd 4
spawned uWSGI http 1 (pid: 7)
uwsgi socket 0 bound to TCP address 127.0.0.1:36530 (port auto-assigned) fd 3
Python version: 3.6.0 (default, Feb 26 2017, 23:43:20)  [GCC 4.9.2]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1df12c0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
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 worker 1 (and the only) (pid: 1, cores: 1)

检查文件的所有权。 uwsgi将与无特权的用户一起运行。 确保www-data或您使用的任何用户具有wsgi.py的读取权限

这是对我有效的配置wsgi.py:

def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return ["Hello!"]

和uwsgi.ini:

[uwsgi]
http = 0.0.0.0:8000
module = wsgi
callable = application

然后像这样启动它:

uwsgi --ini uwsgi.ini

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM