Programming & Web DevelopmentIntermediate

Django Web Development

Models, views, templates, auth and deploying a Python web app.

Taught by Anisha Rai · Senior Software Engineer

What you'll learn

  • Set up a Django project and explain how requests flow through URLs, views, models and templates
  • Design models, run migrations and write efficient ORM queries without N+1 problems
  • Build validated forms with ModelForm and customise the Django admin for real users
  • Add login, logout and per-user access control with Django's built-in authentication
  • Expose models as a JSON API using Django REST Framework serializers and viewsets
  • Deploy a Django app with production settings, Gunicorn, WhiteNoise and PostgreSQL

About this course

Django is the batteries-included Python web framework behind many large sites, and this course shows you how to build and ship a complete web app with it. It is aimed at Python developers who know functions, classes and virtual environments and now want to build for the web. You will learn Django's model-view-template pattern, design models and query them with the ORM, map URLs to views, and render pages with templates. You will then handle forms and validation, customise the admin site, add login and per-user permissions, and expose your data as a JSON API with a taste of Django REST Framework. Finally you will configure production settings, serve static files and deploy with Gunicorn and PostgreSQL. By the end you will have built a working notes app with user accounts and understand how to grow it.

Course content

7 lessons
  1. 1How Django Works: Projects, Apps and MVTDjango's model-view-template pattern, setting up a project, and what each generated file does.Preview
  2. 2Models, Migrations and the ORMDefining models and relationships, evolving the schema with migrations, and querying efficiently.
  3. 3Views, URLs and TemplatesRouting URLs to views, rendering templates with inheritance, and when to use class-based views.
  4. 4Forms, Validation and the Admin SiteAccepting user input safely with ModelForm and giving staff a powerful admin with a few lines of code.
  5. 5Authentication, Permissions and SecurityLogin and logout with built-in views, restricting data to its owner, and Django's security defaults.
  6. 6A Taste of Django REST FrameworkSerialisers, viewsets and routers for a JSON API, plus authentication, permissions and pagination.
  7. 7Deploying Django to ProductionProduction settings, static files, Gunicorn and PostgreSQL, and a pre-launch checklist.