'

Web Development with Python

Понравилась презентация – покажи это...





Слайд 0

Web backends development using Python Ayun Park


Слайд 1

Ayun Park iamparkayun@gmail.com / http://parkayun.kr / https://github.com/Parkayun Prdouct Team Leader at add2paper 2


Слайд 2

add2paper http://www.add2paper.com / http://www.additpay.com Korea No.1 Mobile media for college students. 3


Слайд 3

4


Слайд 4

122 universities 5


Слайд 5

6


Слайд 6

7


Слайд 7

based on django 8


Слайд 8

used flask 9


Слайд 9

used tornado 10


Слайд 10

tried aiohttp 11


Слайд 11

django, flask, tornado and aiohttp 12


Слайд 12

django ● Most popular Python web framework ● Full stack web framework 13


Слайд 13

Most popular 14


Слайд 14

Full stack web framework 15


Слайд 15

= has almost everything 16


Слайд 16

Full stack ● ● ● ● ORM Template Engine Tests And more... 17


Слайд 17

ORM 18


Слайд 18

ORM 19


Слайд 19

ORM >>> Foo.objects.filter(bar__contains=’1’) SELECT "world_foo"."id", "world_foo"."bar", "world_foo"."created_at", "world_foo"."modified_at" FROM "world_foo" WHERE "world_foo"."bar" LIKE ‘%1%’ ESCAPE \'\\\' LIMIT 21 20


Слайд 20

ORM ● ● ● ● MySQL PostgreSQL Oracle MSSQL (unofficial) 21


Слайд 21

template engine 22


Слайд 22

template engine ● a lot of useful builtin tags ○ ○ ○ intcomma autoescape linebreaks ● also can make custom tags 23


Слайд 23

tests ● ● ● ● based on unittest TestCase TransactionTestCase LiveServerTestCase 24


Слайд 24

And more... ● django admin ● useful middlewares ○ session management ■ protection against csrf attack ● migration ● And more... in djangoproject.com 25


Слайд 25

= django has super productivity 26


Слайд 26

In my case 27


Слайд 27

I use django when need web pages(html). 28


Слайд 28

django was born for web sites. 29


Слайд 29

flask ● Very popluar Python web framework in developers ● Microframework 30


Слайд 30

Very popular 31


Слайд 31

Microframework ● Werkzeug ● jinja2 ● useful extensions 32


Слайд 32

Werkzeug 33


Слайд 33

= WSGI Utility Library 34


Слайд 34

= HTTP Server using Python (PEP333) 35


Слайд 35

= URL Route and Response 36


Слайд 36

jinja2 37


Слайд 37

= template engine 38


Слайд 38

similar with django’s 39


Слайд 39

Microframework 40


Слайд 40

= has almost nothing 41


Слайд 41

= has free 42


Слайд 42

= useful extensions 43


Слайд 43

useful extensions ● SQLAlchemy (Flask-SQLAlchemy) ○ ORM ● Alembic (Flask-Alembic) ○ Migration ● Flask-Login ○ session management ● py.test (pytest-flask), nosetest ○ tests ● And more... 44


Слайд 44

In my case 45


Слайд 45

I use flask in anytime. 46


Слайд 46

flask is a microframework. 47


Слайд 47

tornado ● Web framework ● Asynchronous network library 48


Слайд 48

Web framework 49


Слайд 49

similar with flask 50


Слайд 50

= has template engine 51


Слайд 51

also, similar with django’s 52


Слайд 52

but, It hasn’t enough bulitin tags. 53


Слайд 53

Asynchronous network library 54


Слайд 54

= tornado’s key feature 55


Слайд 55

After, Python2 56


Слайд 56

has asyncio 57


Слайд 57

= has async features 58


Слайд 58

But, tornado has that since Python2. 59


Слайд 59

= has good performance since Python2 60


Слайд 60

= can code socket and more 61


Слайд 61

= even as a container 62


Слайд 62

In my case 63


Слайд 63

I use tornado when build websocket and use nosql. 64


Слайд 64

Async is tornado’s key feature. 65


Слайд 65

Not use async with rdbms. 66


Слайд 66

or as a wsgi container 67


Слайд 67

aiohttp ● HTTP Client / Server for asyncio 68


Слайд 68

HTTP Server for asyncio. 69


Слайд 69

= HTTP Server for Python3. 70


Слайд 70

= like a werkzeug in flask. 71


Слайд 71

= URL Route and Response 72


Слайд 72

In my case 73


Слайд 73

I use aiohttp when build websocket or try experiment. 74


Слайд 74

There are some async rdbms driver for Python3. 75


Слайд 75

I just started web framework based on aiohttp. 76


Слайд 76

In github Parkayun/astrid 77


Слайд 77

In Real World 78


Слайд 78

Yes, Python is slow. 79


Слайд 79

check transaction. 80


Слайд 80

check file io. 81


Слайд 81

‘’.join((‘a’, ‘b’)) > ‘a’ + ‘b’ 82


Слайд 82

use Cache (redis, memcached) 83


Слайд 83

uWSGI > gunicorn 84


Слайд 84

use gevent 85


Слайд 85

use PyPy 86


Слайд 86

normal stack 87


Слайд 87

nginx / apache reverse proxy uWSGI / gunicron django / flask Cache (redis / memcached / rabbitmq) MySQL / PostgreSQL / Oracle / MSSQL 88


Слайд 88

Thanks a lot!


Слайд 89


×

HTML:





Ссылка: