flask + nginx + uwsgi - Python application not found


Question

cat /etc/nginx/sites-available/mywebsite

server {
     listen              80;

    server_name         mywebsite;

    location /static {
        alias           /var/www/mywebsite/static;
    }

    location / {
        include         uwsgi_params;
        uwsgi_pass      unix:/tmp/website.sock;
        uwsgi_param         UWSGI_PYHOME    /var/www/mywebsite/env;
        uwsgi_param         UWSGI_CHDIR     /var/www/mywebsite;
        uwsgi_param         UWSGI_MODULE    mywebsite;
        uwsgi_param         UWSGI_CALLABLE  mywebsite;
    }

    error_page          404     /404.html;

}

cat /etc/uwsgi/apps-available/website.ini

[uwsgi]
plugins=python
vhost=true
socket=/tmp/website.sock

cat /var/www/mywebsite/mywebsite.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "It works!"

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

I'm running nginx, then uwsgi and has uWSGI Error 'Python application not found' in browser.

1
5
1/11/2013 12:40:42 PM

I had the same error, in the same configuration, and my problem was simply that the uwsgi service wasn't started. Restarting both nginx and uwsgi solved the problem.

2
3/13/2013 5:13:32 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon