user1561108
user1561108

Reputation: 2747

How to launch my flask app via nginx/uswgi reverse proxy

~/app_dir/
|-/app_venv/
|-/app_module/
   |-appy.py
   |-__init__.py

appy.py looks like:

from flask import Flask

app = Flask(__name__)
#app.debug=True

@app.route('/hello')
def hello():
        return 'World'

if __name__=='__main__':
        app.run(host='0.0.0.0')

then in venv and from ~/app_dir/ I run:

uwsgi --socket 127.0.0.1:5800 -w app_module.appy

except I get a callable not found (it's not an import error as if I change the name of the file I'll get that straight off the bat)

How do I reference the app callable correctly?

Upvotes: 1

Views: 199

Answers (1)

iammehrabalam
iammehrabalam

Reputation: 1325

The default callable for any WSGI-compliant server is named 'application', you've named yours 'app'. You can override this in uwsgi by passing it as the --callable parameter.

uwsgi --socket 127.0.0.1:5800 --wsgi-file app_module/appy.py --callable app --processes 4 --threads 2 

Upvotes: 2

Related Questions