Before a Django application meets real users, it has to be both safe and fast. Django protects you against many common attacks by default, but those protections only work if you understand what they do and avoid switching them off, and a page that is correct but slow will still frustrate the people using it.
In this module you will learn how attacks such as SQL injection
and cross-site scripting (XSS) work and how Django's ORM and
template escaping defend against them. You will then learn how to find and fix slow
database access, including the N+1 query problem, using
select_related() and prefetch_related() together with the
Django Debug Toolbar.
Watch the lessons in order, then continue on to Deployment & Production. Some of these videos were recorded on older Django releases, so check the official documentation if a detail differs on your install.
Part of a Django security series that explains what SQL injection is, how it works, and the protections Django has in place against it.
Demonstrates common ways cross-site scripting shows up in a Django application and how to fix those flaws.
Explains query optimization and solving the N+1 problem with select_related() and prefetch_related(), using the Django Debug Toolbar to see the effect.
A simple introduction to optimizing Django queries with select_related and prefetch_related.