我有一個(gè)騰訊云的服務(wù)器,使用flask,uwsgi,nginx來(lái)搭建一個(gè)服務(wù)器。按照網(wǎng)上的方法是這樣寫(xiě)的。我的nginx配置是我修改的是這個(gè)文件/etc/nginx/sites-enabled/defaultserver{listen80;server_name111.230.140.182;charsetutf-8;client_max_body_size75M;location/{includeuwsgi_params;uwsgi_pass127.0.0.1:8080;uwsgi_paramUWSGI_PYTHON/usr/bin/python;uwsgi_paramUWSGI_CHDIR/home/ubuntu/project/test;uwsgi_paramUWSGI_SCRIPTtest:app;}}然后我的uwsgi.ini配置是這么寫(xiě)的:[uwsgi]socket=127.0.0.1:8080plugins=pythonchidir=/home/ubuntu/project/testwsgi-file=/home/ubuntu/project/test/test.pycallable=app#程序變量名protocol=httpmodule=testprocesses=4threads=2然后我的test.py是這么寫(xiě)的:fromflaskimportFlaskapp=Flask(__name__)@app.route('/')defindex():return'helloworld!'if__name__=='__main__':app.run(debug=True)我先是運(yùn)行nginx,然后在運(yùn)行uwsgi,但是會(huì)報(bào)這個(gè)錯(cuò)誤:mapped332288bytes(324KB)for8coresOperationalMODE:preforking+threadedunabletoloadapp0(mountpoint='')(callablenotfoundorimporterror)unabletofind"application"callableinfile/home/ubuntu/project/test/test.pyunabletoloadapp0(mountpoint='')(callablenotfoundorimporterror)我也查了不少文章都沒(méi)有解決我這個(gè)問(wèn)題。特來(lái)求教!謝謝大家?。?
Python2.7 flask uwsgi nginx配置找不到unable to load app 0
收到一只叮咚
2019-05-21 11:35:27