Checklists

Django implementation checklist

This checklist provides a technical verification path for transitioning Django applications from development to production environments, focusing on performance, security, and scalability.

Progress0 / 30 complete (0%)

Security and Environment Configuration

0/5
  • Disable Debug Mode

    critical

    Set DEBUG=False in the production settings to prevent the exposure of sensitive tracebacks and environment variables.

  • Secret Key Externalization

    critical

    Ensure SECRET_KEY is loaded from an environment variable or a secret manager, and is not hardcoded in the repository.

  • Secure Cookie Settings

    critical

    Set SESSION_COOKIE_SECURE=True and CSRF_COOKIE_SECURE=True to ensure cookies are only transmitted over HTTPS.

  • Host Header Validation

    critical

    Define ALLOWED_HOSTS with specific domain names to prevent HTTP Host header attacks.

  • HSTS Implementation

    recommended

    Set SECURE_HSTS_SECONDS, SECURE_HSTS_INCLUDE_SUBDOMAINS, and SECURE_HSTS_PRELOAD to enforce SSL at the browser level.

Database and Performance Optimization

0/5
  • Database Connection Pooling

    recommended

    Set CONN_MAX_AGE to a value (e.g., 60) to persist database connections and reduce overhead on high-traffic sites.

  • Index Verification

    critical

    Audit models for db_index=True or Meta.indexes on fields used in filtering and ordering to prevent full table scans.

  • N+1 Query Audit

    recommended

    Review views and serializers for missing select_related or prefetch_related calls on foreign key and many-to-many relationships.

  • Database Migration Dry-Run

    critical

    Verify that all migrations have been applied and that no pending model changes exist via 'python manage.py makemigrations --check'.

  • Read-Replica Routing

    optional

    Configure a database router if using read-replicas to offload SELECT queries from the primary write database.

API and DRF Standards

0/5
  • Global Throttling Policy

    critical

    Configure DEFAULT_THROTTLE_CLASSES and DEFAULT_THROTTLE_RATES in DRF settings to prevent API abuse.

  • Mandatory Pagination

    critical

    Enforce DEFAULT_PAGINATION_CLASS for all list views to prevent large database dumps from crashing the application.

  • CORS Whitelist

    critical

    Configure django-cors-headers to only allow requests from trusted frontend origins.

  • Schema Documentation

    recommended

    Generate and verify OpenAPI/Swagger documentation using drf-spectacular or similar tools for consumer integration.

  • Renderer Optimization

    recommended

    Remove BrowsableAPIRenderer from production settings to reduce response payload size and overhead.

Async and Background Tasks

0/5
  • Broker Connectivity and Security

    critical

    Ensure Celery/Redis connections use TLS/SSL and that the broker is not accessible from the public internet.

  • Worker Concurrency Limits

    recommended

    Configure worker concurrency based on available CPU/RAM to prevent OOM (Out of Memory) kills during peak loads.

  • Task Result Expiry

    recommended

    Set CELERY_RESULT_BACKEND_MAX_AGE to prevent the result backend database from growing indefinitely.

  • Dead Letter Queues

    recommended

    Implement retry logic with exponential backoff and a dead-letter queue for failing background tasks.

  • ASGI Timeout Configuration

    critical

    If using async views, configure the ASGI server (e.g., Daphne/Uvicorn) timeouts to match the expected load-balancer timeout.

Static Files and Assets

0/5
  • Manifest Storage

    recommended

    Use ManifestStaticFilesStorage to enable cache-busting by appending MD5 hashes to filenames.

  • WhiteNoise Integration

    recommended

    Configure WhiteNoise or a dedicated CDN to serve static files efficiently without hitting the Django process.

  • Media File Externalization

    critical

    Ensure MEDIA_ROOT is pointed to a persistent volume or cloud storage (S3) rather than ephemeral container storage.

  • Collection Verification

    critical

    Run 'python manage.py collectstatic --noinput' as part of the CI/CD pipeline to verify asset integrity.

  • Compression Implementation

    recommended

    Enable Gzip or Brotli compression for static assets via WhiteNoise or Nginx configuration.

Logging and Monitoring

0/5
  • Structured Logging

    recommended

    Configure JSON logging formatters to allow ELK or Splunk stacks to parse Django logs effectively.

  • Error Tracking Integration

    critical

    Initialize Sentry or a similar SDK to capture unhandled exceptions and performance bottlenecks.

  • Health Check Endpoint

    critical

    Implement a /health/ endpoint that checks database and cache connectivity for load balancer liveness probes.

  • Query Logging Thresholds

    optional

    Set up alerts for slow queries exceeding a specific millisecond threshold in the database layer.

  • Log Rotation

    critical

    Ensure file-based logs (if used) have rotation policies to prevent disk exhaustion.