我有以下uwsgi app.ini文件:
[uwsgi]
wsgi-file = wsgi.py
callable = app
socket = :5000
processes = 5
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
wsgi.py内容:
from app import start
start()
最后是app.py,它是Flask应用程序本身(相当长,所以我只列出相关内容:]]
# instantiate the app app = Flask(__name__, static_url_path='', static_folder='static', template_folder='templates') app.config.from_object(__name__) # enable CORS CORS(app, resources={r'/*': {'origins': '*'}}) @app.route('/') def index(): return render_template('index.html') ... all sort of methods here ... def start(): print("STARTING !!!") app.run(host='0.0.0.0') if __name__ == '__main__': start()
所有文件都在同一文件夹中。当我运行
uwsgi app.ini
时,我得到了:
* Serving Flask app "app" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: on * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) * Restarting with stat unable to load configuration from uwsgi
这是为什么?
感谢您的帮助
我有以下uwsgi app.ini文件:[uwsgi] wsgi-file = wsgi.py可调用=应用套接字=:5000进程= 5线程= 2主=真正的chmod-socket = 660真空=真正的消亡-term = true wsgi.py ...
快速浏览显示了两个问题。首先,uwsgi
和app.run()
不兼容。在使用Flask开发环境时,可以使用后者。 uwsgi
想要保存Flask实例的对象。按照惯例,尽管您可以使用其他名称(并配置app
来查找其他名称),但是该名称为uwsgi
。