2017-02-27 106 views
1

我试图让uwsgi与python一起工作,但没有做什么我做它不能加载我的应用程序..我得到这个错误:无法加载应用程序0(mountpoint ='uwsgi')(可调用找不到或导入错误)

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 

我无法弄清楚什么是错的。我已经通过几个例子,文章和在这个网站上的答案,并没有任何解决了我的问题.. ive尝试命令行初始化和调用.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) 

回答

0

这是在配置为我的作品,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 
+0

正确地复制您的命令..仍然有同样的问题..我会添加整个错误 –

+0

在哪个文件夹uwsgy.py文件?它是否在配置文件夹之外? – MadisonTrash

+0

不,我一直在尽可能简单地让它工作..所有文件都在同一个文件夹中 –

1

检查文件的所有权。 uwsgi将与非特权用户一起运行。 请确保您使用的WWW数据或任何用户具有读访问wsgi.py

相关问题