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

Community
  • 1
  • 1
Jafte
  • 93
  • 12

2 Answers2

3

All you need to know:

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

Two answers from duplicated question

Community
  • 1
  • 1
Jafte
  • 93
  • 12
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.

Community
  • 1
  • 1
Daniel Fairhead
  • 1,103
  • 9
  • 9