4

Run Flask on server with uWsgi.

uWsgi config

<uwsgi>
    <socket>/tmp/flask.sock</socket>
    <pythonpath>/home/reweb/flask/</pythonpath>
    <module>publicist:app</module>
    <plugins>python27</plugins>
    <uid>reweb</uid>
   <touch-reload>/home/reweb/reload</touch-reload>
</uwsgi>

nginx config

upstream flask_serv {
    server unix:/tmp/flask.sock;
}

server {
    listen 80;
    server_name some-domain.com;

    access_log /home/reweb/log/nginx-access.log;
    error_log /home/reweb/log/nginx-error.log;

    location / {
        uwsgi_pass flask_serv;
        include uwsgi_params;
    }
}

But instead of debugger page nginx show me 502 error.
All Flask error traceback i can see in uwsgi error log.

UPDATE
Find old question nginx + uwsgi + flask - disabling custom error pages there is no answer

3

2 Answers 2

3

All you need to know:

https://stackoverflow.com/a/10460399/814470
https://stackoverflow.com/a/17839750/814470

Two answers from duplicated question

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

Comments

1

Flask debug=True does not work when going through uWSGI

may help. Essentially, uwsgi is not intended for development environments where you want debugging info in the browser. It's a production server.

possibly adding in app.debug = true may help, after you have instantiated the Flask object, but otherwise, to get a proper debugger, use the flask internal server for development.

Comments

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.