测试uwsgi,报错Unhandled object from iterator
发布日期:2021-06-28 12:57:19 浏览次数:2 分类:技术文章

本文共 514 字,大约阅读时间需要 1 分钟。

pip install uwsgiuwsgi --version    # 查看 uwsgi 版本

测试 uwsgi 是否正常:

新建 test.py 文件,内容如下:

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

然后在终端运行:

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

在浏览器内输入:http://127.0.0.1:8001,查看是否有"Hello World"输出

访问地址,后台报错:

解决:对于python3则应当注意要指明编码,否则uwsgi不会发送网页内容

​def application(environ, start_response):    start_response('200 OK', [('Content-Type', 'text/html')])    test = 'hello world'    return test.encode("utf-8")

 

转载地址:https://blog.csdn.net/wuyepiaoxue789/article/details/112240544 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python manage.py makemigrations 和 python manage.py migrate的区别
下一篇:Django部署报错:SQLite 3.8.3 or later is required (found 3.7.17)

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年04月09日 18时13分58秒