Samuli Natri Follow on Youtube
Django - The Easy Way (2nd edition)
A step-by-step guide on building Django websites
$39 (eBook)

This book is about learning the Django web framework with simple, practical examples. It guides you through all the main concepts one at the time. By the end of the book you should have a solid understanding of how to build and deploy apps with Django.

Django is a Python based open source web development framework that has been around since 2005. It has been used used by some well-known sites like Instagram, Bitbucket and Disqus.

Table of Contents

  • 1. Installing Python on Windows
    • 1.1 Downloading and installing Python
    • 1.2 Using the interactive prompt
    • 1.3 Details
      • 1.3.1 Python interpreter
    • 1.4 Summary
  • 2. Installing Python on macOS
    • 2.1 Downloading and installing Python
    • 2.2 Using the interactive prompt
    • 2.3 Details
      • 2.3.1 Python interpreter
    • 2.4 Summary
  • 3. Installing Python on Linux
    • 3.1 Installing Python
    • 3.2 Using the interactive prompt
    • 3.3 Details
      • 3.3.1 Python interpreter
    • 3.4 Summary
  • 4. Creating virtual environments in Windows
    • 4.1 Creating and activating virtual environments
    • 4.2 Summary
  • 5. Creating virtual environments in macOS
    • 5.1 Creating and activating virtual environments
    • 5.2 Summary
  • 6. Creating virtual environments in Linux
    • 6.1 Creating and activating virtual environments
    • 6.2 Summary
  • 7. Virtual environments and pip
    • 7.1 Why use virtual environments?
    • 7.2 Details
      • 7.2.1 Organizing folders
      • 7.2.2 Freezing requirements
      • 7.2.3 Excluding venv from the repository
      • 7.2.4 Using other tools
      • 7.2.5 Using python vs python3
    • 7.3 Summary
  • 8. Creating a Django project
    • 8.1 Setup
    • 8.2 Creating a new Project
    • 8.3 Running the development server
    • 8.4 Details
    • 8.5 Summary
  • 9. Creating a Hello World app
    • 9.1 Setup
    • 9.2 Creating apps
    • 9.3 Creating template files
    • 9.4 Creating views
    • 9.5 Adding a homepage path
    • 9.6 Summary
  • 10. Examining the project structure and apps
    • 10.1 Adding features with apps
    • 10.2 Exploring the project structure
    • 10.3 Exploring the project package
    • 10.4 Summary
  • 11. Working with template inheritance
    • 11.1 Setup
    • 11.2 Creating a base app
    • 11.3 Extending templates
    • 11.4 Details
    • 11.5 Summary
  • 12. Installing Bootstrap 4 theme
    • 12.1 Setup
    • 12.2 Modifying an existing template
    • 12.3 Updating the homepage template
    • 12.4 Details
    • 12.5 Summary
  • 13. Managing static files
    • 13.1 Setup
    • 13.2 Creating a stylesheet file
    • 13.3 Details
      • 13.3.1 Working with static files
      • 13.3.2 Using the static tag
      • 13.3.3 Forcing cache refresh with versioning
    • 13.4 Summary
  • 14. Creating models
    • 14.1 Setup
    • 14.2 Creating the Flower model
    • 14.3 Listing flowers
    • 14.4 Details
      • 14.4.1 Explaining models
      • 14.4.2 Returning a string representation
      • 14.4.3 Making database queries
    • 14.5 Summary
  • 15. Creating a base project
    • 15.1 Setup
    • 15.2 Adding a description field
    • 15.3 Adding masonry like columns
    • 15.4 Adding a footer
    • 15.5 Summary
  • 16. Creating a detail page
    • 16.1 Setup
    • 16.2 Adding a detail page path
    • 16.3 Creating the detail view
    • 16.4 Creating the detail page template
    • 16.5 Creating slugs
    • 16.6 Updating the path
    • 16.7 Defining get_absolute_url() method
    • 16.8 Using url tag
    • 16.9 Details
      • 16.9.1 Capturing URL values
      • 16.9.2 Using view parameters
      • 16.9.3 Explaining slugs
      • 16.9.4 Reversing URLS
    • 16.10 Summary
  • 17. Adding category as a many-to-one relationhip
    • 17.1 Setup
    • 17.2 Adding category field and model
    • 17.3 Updating the homepage template
    • 17.4 Details
      • 17.4.1 Examining many-to-one relationships
      • 17.4.2 Accessing related objects
    • 17.5 Summary
  • 18. Referencing tags with a ManyToMany field
    • 18.1 Setup
    • 18.2 Adding the tags field
    • 18.3 Updating the homepage template
    • 18.4 Summary
  • 19. Creating a tags page
    • 19.1 Setup
    • 19.2 Adding tags path
    • 19.3 Adding the slug field
    • 19.4 Creating the tags view
    • 19.5 Updating the homepage template
    • 19.6 Details
      • 19.6.1 Doing lookups across relationships
      • 19.6.2 Reusing templates
    • 19.7 Summary
  • 20. Creating a search feature
    • 20.1 Setup
    • 20.2 Adding a search form
    • 20.3 Updating the index view
    • 20.4 Details
    • 20.5 Summary
  • 21. Working with forms: creating items
    • 21.1 Setup
    • 21.2 Creating the edit form
    • 21.3 Creating the form class
    • 21.4 Updating urlpatterns
    • 21.5 Creating the view function
    • 21.6 Adding a menu item
    • 21.7 Details
      • 21.7.1 Protecting against cross site request forgeries
      • 21.7.2 Adding form fields
      • 21.7.3 Using the Form class
      • 21.7.4 Examining the view function
    • 21.8 Summary
  • 22. Working with forms: editing items
    • 22.1 Setup
    • 22.2 Adding the path
    • 22.3 Creating the edit view
    • 22.4 Updating the edit link
    • 22.5 Details
      • 22.5.1 Capturing the id
      • 22.5.2 Examining the edit view
    • 22.6 Summary
  • 23. Working with forms: customization
    • 23.1 Setup
    • 23.2 Adding the description field
    • 23.3 Details
      • 23.3.1 Changing field order
      • 23.3.2 Customizing validation errors
    • 23.4 Summary
  • 24. Creating and deleting objects
    • 24.1 Setup
    • 24.2 Adding the delete path
    • 24.3 Adding the delete view
    • 24.4 Updating the delete link
    • 24.5 Details
    • 24.6 Summary
  • 25. Authenticating users with Allauth
    • 25.1 Setup
    • 25.2 Installing Allauth
    • 25.3 Creating template files
    • 25.4 Updating the templates for Bootstrap 4
    • 25.5 Details
      • 25.5.1 Configuration options
      • 25.5.2 Adding the paths
      • 25.5.3 django-widget-tweaks
    • 25.6 Summary
  • 26. Authorization
    • 26.1 Setup
    • 26.2 Adding the Editor group
    • 26.3 Creating a test user
    • 26.4 Using permissions
    • 26.5 Using decorators
    • 26.6 Details
      • 26.6.1 Authentication vs authorization
      • 26.6.2 Controlling access with decorators
    • 26.7 Summary
  • 27. Creating an image gallery
    • 27.1 Setup
    • 27.2 Installing pillow
    • 27.3 Configuring media variables
    • 27.4 Adding ImageField
    • 27.5 Adding images to flowers
    • 27.6 Using the static helper function
    • 27.7 Adding the grid
    • 27.8 Details
    • 27.9 Summary
  • 28. Adding image thumbnails
    • 28.1 Setup
    • 28.2 Installing ImageKit
    • 28.3 Adding the thumbnail field
    • 28.4 Details
    • 28.5 Summary
  • 29. Deploying on Heroku
    • 29.1 Setup
    • 29.2 Creating a Heroku app
    • 29.3 Installing Heroku CLI
      • 29.3.1 Installation in Windows
      • 29.3.2 Installation in macOS
      • 29.3.3 Installation in Ubuntu
      • 29.3.4 Authenticating with a browser
    • 29.4 Creating a Procfile
    • 29.5 Updating the settings.py file
    • 29.6 Creating the repository
    • 29.7 Pushing changes
    • 29.8 Updating the database
    • 29.9 Summary
  • 30. Using Amazon AWS to serve files
    • 30.1 Setup
    • 30.2 Creating an Amazon AWS bucket
    • 30.3 Setting up permissions
    • 30.4 Updating settings.py file
    • 30.5 Adding an image field to the Post model
    • 30.6 Installing packages
    • 30.7 Summary
  • 31. Setting up Heroku pipelines
    • 31.1 Setup
    • 31.2 Creating a GitHub repository
    • 31.3 Creating a pipeline
    • 31.4 Testing deployment
    • 31.5 Adding a production app
    • 31.6 Enabling review apps
    • 31.7 Using pull requests
    • 31.8 Deleting the branch
    • 31.9 Summary
  • 32. Sending emails with SendGrid
    • 32.1 Creating an account
    • 32.2 Summary