2013-02-13 35 views
2

我安裝uwsgi nginx的在我的Ubuntu 12.04 homerserver並試圖測試一個簡單的瓶應用內:瓶+ uwsgi + nginx的:類型錯誤:...不帶任何參數(2給出)

from flask import Flask 
app = Flask(__name__) 

@app.route('/') 
def application(): 
    return 'Hello World!' 

if __name__ == '__main__': 
    app.run() 

python app.py有用。 但不是uwsgi --socket 127.0.0.1:3031 --file /srv/www/test/app.py --callable application --catch-exceptions

我剛剛得到一個這個錯誤TypeError: application() takes no arguments (2 given),不知道爲什麼。這兩個論點來自哪裏?

這裏是我的uwsgi.conf:

1 description "uWSGI Emperor" 
    2 start on runlevel [2345] 
    3 stop on runlevel [06] 
    4 respawn 
    5 
    6 exec uwsgi --master --die-on-term --emperor /etc/uwsgi/apps-enabled 

和我的nginx.conf

server { 
94  listen 8000; 
95  server_name localhost; 
96  root /srv/www/test; 
97 
98  location /static/ { 
99  alias /srv/www/test/static/; 
100  expires 30d; 
101  access_log off; 
102  } 
103 
104  location/{ 
105  include uwsgi_params; 
106  uwsgi_pass 127.0.0.1:3031; 
107 } 
108 } 

我在一個.ini文件之前,嘗試應用程序啓用,但我得到這樣的錯誤太。

我希望有人能幫助我。 :\

回答

4

「應用程序」是一個可調用的(由您定義的)不是可調用的WSGI(如您在uWSGI中配置的)。您的WSGI可調用爲「app」(主入口點)。只需更改 - 可調用應用程序 - 可調用應用程序

+0

Thx roberto。 :) 它現在的作品! – 2013-02-13 06:22:50

相關問題