Python Web framework for quick Mastery!

Source: Internet
Author: User

Web Framework Environment number of Requests/S Average Time
Sanic Python 3.5 & Uvloop 31 3ms
Wheezy Gunicorn & Meinheld 21st 5ms
Falcon Gunicorn & Meinheld 19 6ms
Bottle Gunicorn & Meinheld 14 7ms
Flask Gunicorn & Meinheld 5 20ms
Kyoukai Python 3.5 & Uvloop 4 27ms
Aiohttp Python 3.5 & Uvloop 3 33ms

Installation

Environment: python3.5

Run Python3 main.py

Does sanic look like flask?

Request

Routing

And flask Almost, a look at it

Blueprint

Like the blueprints in flask, for organizing project structures

Create a blueprint that is equivalent to creating a Sanic app with the same usage as above and changing the app to a blueprint name BP

Blueprint registration to the main app

From sanic import sanicfrom my_blueprint Import Bpapp = Sanic (__name__) app.register_blueprint (BP) app.run (host= ' 0.0.0.0 ', port=8000, Debug=true)

Summarize

Sanic will be a very popular framework. Because it's based on python3.5, it uses many new features that make the program faster.

Python Web framework for quick Mastery!

Related Article

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.