猿问

Python2.7 flask uwsgi nginx配置找不到unable to load app 0

我有一个腾讯云的服务器,使用flask,uwsgi,nginx来搭建一个服务器。按照网上的方法是这样写的。我的nginx配置是我修改的是这个文件/etc/nginx/sites-enabled/default
server{
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:8080
plugins=python
chidir=/home/ubuntu/project/test
wsgi-file=/home/ubuntu/project/test/test.py
callable=app#程序变量名
protocol=http
module=test
processes=4
threads=2
然后我的test.py是这么写的:
fromflaskimportFlask
app=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)
我也查了不少文章都没有解决我这个问题。特来求教!谢谢大家!!
收到一只叮咚
浏览 676回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答