Python WEB Framework sanic Linux Platform installation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.