1. Operating system
CentOS 7.2 X64
2. Install the System Package
Gcc-c++
Zlib-devel
3.update Python 3.5
1). Install Python
Python-3.5.2.tgz
./configure
Make
Make install
2). New version of Soft connection
Cd/usr/bin
RM python
Ln-s/usr/local/bin/python3/usr/bin/python
4. Install the Python package
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. Test the installation
Root user,/home/directory new helloword.py
1). Server program
# 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). Run Access
# python helloword.py
2016-12-09 23:21:22,333:info:goin ' Fast @ http://0.0.0.0:8000
Client Access
Http://serverip:8000/
Appear
{"Hello": "World"}
This article is from the "Yiyi" blog, make sure to keep this source http://heyiyi.blog.51cto.com/205455/1881380
Python WEB Framework sanic Linux Platform installation