by Sanyam Khurana (@curiouslearner) on Saturday, 9 September 2017

+2
Vote on this proposal
Status: Submitted
Technical level
Intermediate

Media

Abstract

Many amateur developers who picks up Django write code which seems to work, but fails at scale.

Django has been made as a The web framework for perfectionists with deadlines, and perfection is often forgotten due to deadlines. In this talk, we’ll discuss about common pitfalls to avoid while working on a Django based web application. Often times we don’t care about what the ORM queries are costing us and if they could be written in a better way.

In the end we’ll look at an overall architecture of entire Django web application including wsgi, nginx, caching and database layer. This would provide a starting point to write clean code and optimizing Django Applications to the audience

Outline

  • Profiling our web application to know exactly what queries are being executed on the database.
  • Making optimal use of Django ORM to avoid multiple queries to the database.
  • Usage of F objects, Q objects, prefetch_related, select_related et. all.
  • Addressing n+1 queries problems to database with ORM.
  • Making use of Asynchronous requests to avoid creating a backlog for the request-response cycle. A little bit about task queues like Celery.
  • Caching: Different types of caches to use – both django caching as well as something like in-memory Redis cache.

Requirements

  • Hands-on experience with developing Django Applications
  • Basic understanding of Django ORM including usage of Querysets and Managers.

Speaker bio

Sanyam is an Open Source Contributor from Delhi, India. Mostly goes by CuriousLearner all over the web. He contributes to various upstream projects in different organizations & maintains a few of them. He has contributed various patches and bug reports upstream to Gecko Engine from Mozilla Organization.

Recently he is getting his hands dirty with CPython codebase.

He is a vouched Mozillian & an official Representative of Mozilla and has been listed in AUTHORS as well as credits section of every browser ever released by Mozilla. He mentored for PyDSA in RGSoC 2017. He volunteers for PyCon India and PyDelhiConf and has been an active member of PyDelhi, ILUG-D, LinuxChixIndia and DGPLUG.