Developing Software using Python and Django to solve real life problems
Real world Python+django
Click here to load reader
-
Upload
joel-correa -
Category
Technology
-
view
359 -
download
4
Transcript of Real world Python+django
![Page 1: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/1.jpg)
Real world
Joel Correa – Software engineer
![Page 2: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/2.jpg)
\ There are some ordinary
topics…
View
ORM Admin interface
URL design
Template
Model
I18n
![Page 3: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/3.jpg)
Function-based views
![Page 4: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/4.jpg)
But, guess what… There is much more
![Page 5: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/5.jpg)
Class-based views (CBVs)
View RedirectView
TemplateView
ListView
DetailView
CreateView
UpdateView
![Page 6: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/6.jpg)
Class-based views
![Page 7: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/7.jpg)
Fixtures
JSON SQL
![Page 8: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/8.jpg)
Fixtures
![Page 9: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/9.jpg)
OK for very small, hard-coded datasets
NOK for large datasets, and migrations
Fixtures
![Page 10: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/10.jpg)
OK for very small, hard-coded datasets
NOK for large datasets, and migrations
Fixtures
![Page 11: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/11.jpg)
Schema migration Data migration
![Page 12: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/12.jpg)
Validating user input
![Page 13: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/13.jpg)
Model
Form
Formset
Input validation layers
![Page 14: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/14.jpg)
Use pip
![Page 15: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/15.jpg)
Managing packages
$ pip install SomePackage==1.0!![…]!Successfully installed SomePackage!!
![Page 16: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/16.jpg)
Set up a virtualenv
![Page 17: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/17.jpg)
$ 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](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/18.jpg)
$ pip freeze > requirements.txt!
Freeze your deps
$ pip install –r requirements.txt!
Recreate env
![Page 19: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/19.jpg)
Coding style = PEP8 http://www.python.org/dev/peps/pep-0008/
![Page 20: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/20.jpg)
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](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/21.jpg)
Celery
Distributed task Queue
Amazon SQS
RabbitMQ
IronMQ
![Page 22: Real world Python+django](https://reader037.fdocuments.in/reader037/viewer/2022100218/5583fb57d8b42af00a8b4591/html5/thumbnails/22.jpg)
Real world
Joel Correa – Software engineer