简体   繁体   中英

Flask/uWSGI throws error unable to load app 0 (mountpoint='')

Im trying to run (just for testing purposes):

uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi_prod

from a dir with:

home.py
home.pyc
wsgi_prod.py
wsgi_prod.pyc

my wsgi_prod.py has:

from home import app

if __name__ == "__main__":
    app.run()

home.py has:

from flask import Flask, render_template
from jinja2 import Template

app = Flask(__name__, static_folder='static')

@app.route('/')
def home():
    print('Hello world')
if __name__ == '__main__':
    app.run(host='0.0.0.0')

When I run it, it throws:

unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) 

What am I doing wrong? Why cant it see my app?

Thank you!

Well, I hope this helps someone out someday. Digital Ocean offers a great article to setup your flask/uwsgi, but offers the wrong command for this.

Use this instead:

uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi_prod:app

and use this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM