码迷,mamicode.com
首页 > 移动开发 > 详细

初次使用uwsgi:no python application found, check your startup logs for errors

时间:2017-12-26 21:02:26      阅读:688      评论:0      收藏:0      [点我收藏+]

标签:file   python3   body   执行   pip   style   whoami   uwsgi   html   

按照文档,首先写一个test.py的文件,进行测试是否安装成功

1 def application(env, start_response):
2     start_response(200 OK, [(Content-Type,text/html)])
3     return ["Hello World"]

 

结果刚开始既不显示内容,也不现实错误

仔细查看运行回显:出现了一段 没有使用 pcre,于是重新安装 uwsgi

首先执行

sudo pip uninstall uwsgi

出现了 没有目录权限的提示

执行, sudo chown -R $(whoami) /***/http

然后重新执行, sudo pip uninstall uwsgi

卸载完成

重新安装,这次没有采用pip install uwsgi

而是,直接在https://pypi.python.org/pypi/uWSGI/ 进行下载tar包

执行

tar -xvf uwsgi-2.0.15.tar.gz

cd uwsgi-2.0.15

make

重新执行,结果一直显示 no python application found, check your startup logs for errors

查看手册,发现python3,需要使用下面的代码

1 def application(env, start_response):
2     start_response(200 OK, [(Content-Type,text/html)])
3     return [b"Hello World"]

可是仍旧不行

重新查看手册,发现,需要在命令行添加参数 --plugin python

执行下面命令行: 

uwsgi --plugin python --http :8001 --wsgi-file test.py

重新访问 localhost:8001

就可以看到 成功的显示了 ‘Hello world‘

 

PS:附件为uwsgi的手册

https://media.readthedocs.org/pdf/uwsgi-docs-additions/latest/uwsgi-docs-additions.pdf

 

初次使用uwsgi:no python application found, check your startup logs for errors

标签:file   python3   body   执行   pip   style   whoami   uwsgi   html   

原文地址:https://www.cnblogs.com/loveyangaddddd/p/8119720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!