The Django Jigsaw Puzzle: Aligning All the Pieces with Will Vincent - DjangoCon US 2022

"Aligning Django's puzzle pieces: learn how to effectively build with the framework's components, from views to templates, middleware to internationalization, at DjangoCon US 2022."

Key takeaways
  • avoid using pythonmanage.py in favor of the settings module
  • learn Django iteratively, don’t try to understand everything at once
  • the Django framework is built of smaller pieces, like a jigsaw puzzle
  • the request-response cycle is the core of Django
    • it starts with views.py, which handles HTTP requests
    • uses models to interact with databases
    • uses templates to render HTML
    • uses URL routing to match URLs to views
  • middleware is a hook into the request-response cycle
  • the Django admin is a powerful tool, but can be overwhelming
  • testing is crucial; use pytest instead of the default Django testing
  • templates are easy to customize; use Jinja or React if needed
  • static files can be tricky; use whizgee to optimize and serve statically generated files
  • avoid using startapp and startproject commands; instead, create a new project and app levels
  • internationalization and localization are powerful features; use ugettext and format functions to translate
  • the order of operations in the request-response cycle is: client -> web server -> whizgee server -> Django app