Fork me on GitHub

Project Notes

Lightweight Django

Book notes - Lightweight Django, By Julia Elman, Mark Lavin, published by O’Reilly.


Table of Contents - Highlights

1. The World’s Smallest Django Project

  • Hello Django
    • Creating the View
    • The URL Patterns
    • The Settings
    • Running the Example
  • Improvements
    • WSGI Application
    • Additional Configuration
    • Reusable Template

2. Stateless Web Application

  • Why Stateless?
  • Reusable Apps Versus Composable Services
  • Placeholder Image Server
    • Views
    • URL Patterns
  • Placeholder View
    • Image Manipulation
    • Adding Caching
  • Creating the Home Page View
    • Adding Static and Template Settings
    • Home Page Template and CSS
    • Completed Project

3. Building a Static Site Generator

  • Creating Static Sites with Django
  • What Is Rapid Prototyping?
  • Initial Project Layout
    • File/Folder Scaffolding
    • Basic Settings
  • Page Rendering
    • Creating Our Base Templates
    • Static Page Generator
    • Basic Styling
    • Prototype Layouts and Navigation
  • Generating Static Content
    • Settings Configuration
    • Custom Management Command
    • Building a Single Page
  • Serving and Compressing Static Files
    • Hashing Our CSS and JavaScript Files
    • Compressing Our Static Files
  • Generating Dynamic Content
    • Updating Our Templates
    • Adding Metadata

4. Building a REST API

  • Django and REST
  • Scrum Board Data Map
    • Initial Project Layout
    • Project Settings
    • No Django Admin?
    • Models
  • Designing the API
    • Sprint Endpoints
    • Task and User Endpoints
    • Connecting to the Router
    • Linking Resources
  • Testing Out the API
    • Using the Browsable API
    • Adding Filtering
    • Adding Validations
    • Using a Python Client
  • Next Steps

5. Client-Side Django with Backbone.js

  • Brief Overview of Backbone
  • Setting Up Your Project Files
    • JavaScript Dependencies
    • Organization of Your Backbone Application Files
  • Connecting Backbone to Django
  • Client-Side Backbone Routing
    • Creating a Basic Home Page View
    • Setting Up a Minimal Router
    • Using _.template from Underscore.js
  • Building User Authentication
    • Creating a Session Model
    • Creating a Login View
    • Generic Form View
    • Authenticating Routes
    • Creating a Header View

6. Single-Page Web Application

  • What Are Single-Page Web Applications?
  • Discovering the API
    • Fetching the API
    • Model Customizations
    • Collection Customizations
  • Building Our Home Page
  • Displaying the Current Sprints
  • Creating New Sprints
  • Sprint Detail Page
    • Rendering the Sprint
    • Routing the Sprint Detail
    • Using the Client State
    • Rendering the Tasks
    • AddTaskView
  • CRUD Tasks
    • Rendering Tasks Within a Sprint
    • Updating Tasks
    • Inline Edit Features

7. Real-Time Django

  • HTML5 Real-Time APIs
    • Websockets
    • Server-Sent Events
    • WebRTC
  • Websockets with Tornado
    • Introduction to Tornado
    • Message Subscriptions
  • Client Communication
    • Minimal Example
    • Socket Wrapper
    • Client Connection
    • Sending Events from the Client
    • Handling Events from the Client
    • Updating Task State

8. Communication Between Django and Tornado

  • Receiving Updates in Tornado
    • Sending Updates from Django
    • Handling Updates on the Client
  • Server Improvements
    • Robust Subscriptions
    • Websocket Authentication
    • Better Updates
    • Secure Updates
  • Final Websocket Server

Getting the Example Source

git clone example_source

Credits and References

Project Source on GitHub Return to the Project Catalog

This page is a web-friendly rendering of my project notes shared in the LittleCodingKata GitHub repository.

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.