Flask, nginx, and uwsgi

前端 未结 2 1961
逝去的感伤
逝去的感伤 2021-01-13 07:08

My flask app looks like this...
myapp.py

from flask import Flask  
app = Flask(__name__) 

@app.route(\"/\")  
def hello():  
   return          


        
相关标签:
2条回答
  • 2021-01-13 08:09

    unix sockets are filesystem objects, so nginx need write permissions to /tmp/uwsgi.sock

    You are running uWSGI as root (why ???) so /tmp/uwsgi.sock will be owned by root while nginx generally runs as nobody or www-data.

    If you do not want to take in account permissions just use TCP sockets, but obviously do not run your app as root.

    0 讨论(0)
  • 2021-01-13 08:10

    You can have a look on this: Python flask with Nginx and uWSGI as the repo provides the exact case / scenario on how to use Flask in production mode.

    0 讨论(0)
提交回复
热议问题