Reputation: 4461
I installed uwsgi with nginx on my ubuntu 12.04 homerserver and try to test a simple Flask-App:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def application():
return 'Hello World!'
if __name__ == '__main__':
app.run()
with python app.py
it works.
But not with uwsgi --socket 127.0.0.1:3031 --file /srv/www/test/app.py --callable application --catch-exceptions
I just get a this error TypeError: application() takes no arguments (2 given)
and don't know why. Where this two arguments come from?
Here is my 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
and my 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 }
i try it before with an .ini-file in apps-enabled but i get this way errors too.
I hope that someone can help me. :\
Upvotes: 2
Views: 1819
Reputation: 12953
"application" is a flask callable (defined by you) not a WSGI callable (like you configured in uWSGI). Your WSGI callable is "app" (the main entry point). Just change --callable application to --callable app
Upvotes: 4