This talk summarizes my learnings (best practices and gotchas) by using Django as the core application engine in a production application for the past two years at DoSelect. I’ll discuss about the common, and not-so-common patterns you should take care of when you hit scale with Django, complete with real- life scenarios. Topics include (non-exhaustive) – production server configuration, best practices when using Django as provider for an SPA (Single-page app), caching, query optimization while using the ORM, gotchas while using async tasks, et al.
The talk is intended for people who have a basic knowlegde of Python / Django, know how web applications work in general. Key take-aways would be things you can directly drop into your production Django application for better performance.
The Usual Suspects
- Tuning your web server configuration (using Nginx and Gunicorn as example)
- Caching whatever you can, but no more
- How to write Django ORM queries that scale
- When NOT to write Django ORM queries
- Async tasks while maintaining data consistency
The Non-usual Suspects
- Using Django with an SPA front-end
- Scaling Postgres while scaling Django
- Optmizing async task runners (more stuff to be added)
The talk will include real-world code examples while illustating the points above – explaining what we faced in production, and how we solved it (and then realized that’s what we should have done in the first place). I plan to have a bit longer Q&A session, due to the nature of this talk.