Contents

#Section
1The Three-Folder Rule
2Static Folder Structure
3Template Folder Structure
4File Naming Standard
5base.html Standard
6Template Block Standards
7CSS Organization Rules
8JavaScript Rules
9What Goes Where — Decision Table
10Django App Template Isolation
11Static File Loading
12Reusable Template Components
13Anti-Patterns to Avoid
14Definition of Done — Django Template Work

The Three-Folder Rule

static/
  css/       <- All styles. Nothing else.
  js/        <- All JavaScript. Nothing else.
  images/    <- All images, icons, logos.

templates/   <- All HTML. No inline styles. No inline scripts.

Never:

  • Write <style> blocks inside an HTML template.
  • Write <script> blocks with logic inside an HTML template.
  • Put images directly in your templates/ folder.
  • Mix styles from multiple components into one giant CSS file.

Reference Document

This page now follows the root source document. For the full section-by-section standard, use Django Template Standards.