发布时间:2019-08-31 09:45:33编辑:auto阅读(2210)
1.操作系统
CentOS 7.2 X64
2.安装系统包
gcc-c++
zlib-devel
openssl-devel
3.update python 3.5
1).安装Python
Python-3.5.2.tgz
./configure
make
make install
2).软连接新版本
cd /usr/bin
rm python
ln -s /usr/local/bin/python3 /usr/bin/python
4.安装Python包
1).setuptools-30.3.0.tar.gz
2).uvloop-0.6.7.tar.gz
3).multidict-2.1.4.tar.gz
4).aiofiles-0.3.0.tar.gz
5).ujson-1.35.tar.gz
6).httptools-0.0.9.tar.gz
7).Sanic-0.1.8.tar.gz
5.测试安装
root用户,/home/目录新建helloword.py
1). server程序
# vi helloword.py
from sanic import Sanic
from sanic.response import json
app = Sanic()
@app.route("/")
async def test(request):
return json({"hello": "world"})
app.run(host="0.0.0.0", port=8000)
2).运行访问
# python helloword.py
2016-12-09 23:21:22,333: INFO: Goin' Fast @ http://0.0.0.0:8000
客户端访问
http://serverip:8000/
出现
{"hello": "world"}
上一篇: 给PDF添加水印(Python+C#)
下一篇: centos6.4升级Python过程总
50055
49311
39976
37015
31410
28249
27206
21999
21956
20282
422°
309°
291°
473°
454°
1069°
2000°
1857°
1474°
2981°