我有一个腾讯云的服务器,使用flask,uwsgi,nginx来搭建一个服务器。按照网上的方法是这样写的。我的nginx配置是我修改的是这个文件/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配置是这么写的:[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是这么写的:fromflaskimportFlaskapp=Flask(__name__)@app.route('/')defindex():return'helloworld!
'if__name__=='__main__':app.run(debug=True)我先是运行nginx,然后在运行uwsgi,但是会报这个错误:mapped332288bytes(324KB)for8coresOperationalMODE:preforking+threadedunabletoloadapp0(mountpoint='')(callablenotfoundorimporterror)unabletofind"application"callableinfile/home/ubuntu/project/test/test.pyunabletoloadapp0(mountpoint='')(callablenotfoundorimporterror)我也查了不少文章都没有解决我这个问题。特来求教!谢谢大家!!
相关分类