real world python+django

22

Click here to load reader

Upload: joel-correa

Post on 19-Jun-2015

368 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Real world Python+django

Real world

Joel Correa – Software engineer

Page 2: Real world Python+django

\ There are some ordinary

topics…

View

ORM Admin interface

URL design

Template

Model

I18n

Page 3: Real world Python+django

Function-based views

Page 4: Real world Python+django

But, guess what… There is much more

Page 5: Real world Python+django

Class-based views (CBVs)

View RedirectView

TemplateView

ListView

DetailView

CreateView

UpdateView

Page 6: Real world Python+django

Class-based views

Page 7: Real world Python+django

Fixtures

JSON SQL

Page 8: Real world Python+django

Fixtures

Page 9: Real world Python+django

OK for very small, hard-coded datasets

NOK for large datasets, and migrations

Fixtures

Page 10: Real world Python+django

OK for very small, hard-coded datasets

NOK for large datasets, and migrations

Fixtures

Page 11: Real world Python+django

Schema migration Data migration

Page 12: Real world Python+django

Validating user input

Page 13: Real world Python+django

Model

Form

Formset

Input validation layers

Page 14: Real world Python+django

Use pip

Page 15: Real world Python+django

Managing packages

$ pip install SomePackage==1.0!![…]!Successfully installed SomePackage!!

Page 16: Real world Python+django

Set up a virtualenv

Page 17: Real world Python+django

$ virtualenv env!$ source env/bin/activate!!

$ pip freeze!!Django == 1.5.4!Fabric == 1.7.0!MySQL-python == 1.2.4!PIL == 1.1.7!PyRSS2Gen == 1.0.0!South == 0.8.1!

Isolate environments

Check your deps

Page 18: Real world Python+django

$ pip freeze > requirements.txt!

Freeze your deps

$ pip install –r requirements.txt!

Recreate env

Page 19: Real world Python+django

Coding style = PEP8 http://www.python.org/dev/peps/pep-0008/

Page 20: Real world Python+django

Code layout

Comments

Naming conventions

Programming conventions

Public and internal interfaces

Coding style = PEP8 http://www.python.org/dev/peps/pep-0008/

Page 21: Real world Python+django

Celery

Distributed task Queue

Amazon SQS

RabbitMQ

IronMQ

Page 22: Real world Python+django

Real world

Joel Correa – Software engineer