2017-02-27 105 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

相關問題