5

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

UWSGI_CALLABLE must be 'app' (is the name of the function to call on the request)

7 Comments

I made a correction to the nginx config, as you say, but still the problem exists. Here is my uwsgi log file link maybe the problem is in --enable-threads ?
i do not see requests logged in the file you linked, when you make a request to the nginx you should see something in uWSGI logs. If you do not see things check nginx logs, maybe it cannot connect to uWSGI
I restarted the uwsgi and now there are several errors in uwsgi log file. They are all the same :) "ImportError: No module named flask " It is very strange, because I have installed Flask in my virtualenv.
is the virtualenv in /var/www/mywebsite/env and is it for the same python version used by uWSGI (as printed on startup) ?
It seems this is the source of all problems. I have installed 2.7 version, but when I call the python interpreter I get version 2.6. Virtualenv is in /var/www/mywebsite/env.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.