Web backends development using Python

89
Web backends development using Python Ayun Park

Transcript of Web backends development using Python

Page 1: Web backends development using Python

Web backends developmentusing PythonAyun Park

Page 2: Web backends development using Python

Ayun [email protected] / http://parkayun.kr /

https://github.com/Parkayun

2

Page 3: Web backends development using Python

add2paperhttp://www.add2paper.com / http://www.additpay.com

Korea No.1 Mobile media for college students.

3

Page 4: Web backends development using Python

4

Page 5: Web backends development using Python

5

122 universities

Page 6: Web backends development using Python

6

Page 7: Web backends development using Python

7

Page 8: Web backends development using Python

based on django

8

Page 9: Web backends development using Python

used flask

9

Page 10: Web backends development using Python

used tornado

10

Page 11: Web backends development using Python

tried aiohttp

11

Page 12: Web backends development using Python

django, flask, tornado and

aiohttp12

Page 13: Web backends development using Python

djangoMost popular Python web framework

Full stack web framework

13

Page 14: Web backends development using Python

Most popular

14

Page 15: Web backends development using Python

Full stackweb framework

15

Page 16: Web backends development using Python

= has almost everything

16

Page 17: Web backends development using Python

Full stackORM

Template Engine

Tests

And more...

17

Page 18: Web backends development using Python

ORM

18

Page 19: Web backends development using Python

ORM

19

Page 20: Web backends development using Python

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

Page 21: Web backends development using Python

ORMMySQL

PostgreSQL

Oracle

MSSQL (unofficial)

21

Page 22: Web backends development using Python

template engine

22

Page 23: Web backends development using Python

template enginea lot of useful builtin tags

intcomma

autoescape

linebreaks

also can make custom tags

23

Page 24: Web backends development using Python

testsbased on unittest

TestCase

TransactionTestCase

LiveServerTestCase

24

Page 25: Web backends development using Python

And more...django admin

useful middlewares

session management

protection against csrf attack

migration

And more... in djangoproject.com 25

Page 26: Web backends development using Python

= django has super productivity

26

Page 27: Web backends development using Python

In my case

27

Page 28: Web backends development using Python

I use django when need web

pages(html).28

Page 29: Web backends development using Python

django was born for web sites.

29

Page 30: Web backends development using Python

flaskVery popluar Python web framework in developers

Microframework

30

Page 31: Web backends development using Python

Very popular

31

Page 32: Web backends development using Python

Werkzeug

jinja2

useful extensions

Microframework

32

Page 33: Web backends development using Python

Werkzeug

33

Page 34: Web backends development using Python

= WSGI Utility Library

34

Page 35: Web backends development using Python

= HTTP Server using Python

(PEP333)35

Page 36: Web backends development using Python

= URL Route and Response

36

Page 37: Web backends development using Python

jinja2

37

Page 38: Web backends development using Python

= template engine

38

Page 39: Web backends development using Python

similar with django’s

39

Page 40: Web backends development using Python

Microframework

40

Page 41: Web backends development using Python

= has almost nothing

41

Page 42: Web backends development using Python

= has free

42

Page 43: Web backends development using Python

= useful extensions

43

Page 44: Web backends development using Python

SQLAlchemy (Flask-SQLAlchemy)ORM

Alembic (Flask-Alembic)Migration

Flask-Login

session management

py.test (pytest-flask), nosetest

tests

And more...

useful extensions

44

Page 45: Web backends development using Python

In my case

45

Page 46: Web backends development using Python

I use flask inanytime.

46

Page 47: Web backends development using Python

flask isa microframework.

47

Page 48: Web backends development using Python

tornadoWeb framework

Asynchronous network library

48

Page 49: Web backends development using Python

Web framework

49

Page 50: Web backends development using Python

similar with flask

50

Page 51: Web backends development using Python

= has template engine

51

Page 52: Web backends development using Python

also, similar withdjango’s

52

Page 53: Web backends development using Python

but, It hasn’tenough bulitin

tags.53

Page 54: Web backends development using Python

Asynchronousnetwork library

54

Page 55: Web backends development using Python

= tornado’s key feature

55

Page 56: Web backends development using Python

After, Python2

56

Page 57: Web backends development using Python

has asyncio

57

Page 58: Web backends development using Python

= has async features

58

Page 59: Web backends development using Python

But, tornado has that

since Python2.59

Page 60: Web backends development using Python

= has good performancesince Python2

60

Page 61: Web backends development using Python

= can code socketand more

61

Page 62: Web backends development using Python

= even as a container

62

Page 63: Web backends development using Python

In my case

63

Page 64: Web backends development using Python

I use tornado whenbuild websocketand use nosql.

64

Page 65: Web backends development using Python

Async is tornado’skey feature.

65

Page 66: Web backends development using Python

Not use asyncwith rdbms.

66

Page 67: Web backends development using Python

or as a wsgi container

67

Page 68: Web backends development using Python

aiohttpHTTP Client / Server for asyncio

68

Page 69: Web backends development using Python

HTTP Serverfor asyncio.

69

Page 70: Web backends development using Python

= HTTP Serverfor Python3.

70

Page 71: Web backends development using Python

= like a werkzeugin flask.

71

Page 72: Web backends development using Python

= URL Route and Response

72

Page 73: Web backends development using Python

In my case

73

Page 74: Web backends development using Python

I use aiohttp whenbuild websocket

or try experiment.74

Page 75: Web backends development using Python

There are someasync rdbms driver

for Python3.75

Page 76: Web backends development using Python

I just started web frameworkbased on aiohttp.

76

Page 77: Web backends development using Python

In githubParkayun/astrid

77

Page 78: Web backends development using Python

In Real World

78

Page 79: Web backends development using Python

Yes, Python is slow.

79

Page 80: Web backends development using Python

check transaction.

80

Page 81: Web backends development using Python

check file io.

81

Page 82: Web backends development using Python

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

82

Page 83: Web backends development using Python

use Cache(redis, memcached)

83

Page 84: Web backends development using Python

uWSGI > gunicorn

84

Page 85: Web backends development using Python

use gevent

85

Page 86: Web backends development using Python

use PyPy

86

Page 87: Web backends development using Python

normal stack

87

Page 88: Web backends development using Python

django / flask

88

uWSGI / gunicronnginx / apache

MySQL / PostgreSQL / Oracle / MSSQL

Cache(redis / memcached / rabbitmq)

reverse proxy

Page 89: Web backends development using Python

Thanks a lot!