码迷,mamicode.com
首页 > 系统相关 > 详细

linux-ubuntu安装配置uwsgi

时间:2018-11-13 16:10:34      阅读:388      评论:0      收藏:0      [点我收藏+]

标签:targe   python2   code   image   sgi   text   方式   apt-get   sudo   

参考原文

对于 Python2.x 版本:(测试通过)

第一步:sudo apt-get install python-dev

第二步:sudo apt-get install python-pip 
第三部:sudo pip install uwsgi 

 

对于 Python3.x 版本:

第一步:sudo apt-get install python3-dev

第二步:sudo apt-get install python3-pip 
第三部:sudo pip3 install uwsgi

 

 测试uwsgi,创建test.py

def application(env, start_response):
    start_response(‘200 OK‘, [(‘Content-Type‘,‘text/html‘)])
    return [b"Hello uwsgi!"]

uwsgi运行该文件

uwsgi --http-socket :8088 --wsgi-file test.py

技术分享图片

 成功

 

第二种方式使用配置文件运行uwsgi,可以简化命令,配置文件的格式我喜欢使用ini的格式

任意地方创建uwsgi.ini,内容如下:

[uwsgi]
http-socket= :8088
chdir=/home/xlf
wsgi-file=test.py

可以这样运行

到uwsgi.ini目录下

执行 uwsgi --ini ./uwsgi.ini

 

linux-ubuntu安装配置uwsgi

标签:targe   python2   code   image   sgi   text   方式   apt-get   sudo   

原文地址:https://www.cnblogs.com/lfxiao/p/9952442.html

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