我试图运行(仅用于测试目的):
uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi_prod
来自一个目录:
home.py home.pyc wsgi_prod.py wsgi_prod.pyc
我wsgi_prod.py
有:
from home import app if __name__ == "__main__": app.run()
home.py
具有:
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')
当我运行它时,它抛出:
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)
我究竟做错了什么?为什么它看不到我的应用程序?
谢谢!
好吧,我希望有一天能帮助别人.Digital Ocean提供了一个很好的文章来设置你的flask/uwsgi,但是为此提供了错误的命令.
请改用:
uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi_prod:app
并使用此链接