
Django Security
This is your production Django security checklist in one place. It covers the settings you need to lock down before deployment (HSTS, secure cookies, ALLOWED_HOSTS), authentication patterns like custom user models and Argon2 password hashing, and authorization with permission mixins and RBAC. The SQL injection section shows safe ORM usage versus dangerous raw queries, and the XSS part walks through template escaping and the escapejs filter. Use this when you're hardening a Django app for production, setting up auth, or doing a security review. It's comprehensive without being theoretical, just the code you actually need to write.
- skills.sh installs
- 6.1K
- GitHub stars
- 300.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add affaan-m/ecc --skill django-security --agent claude-codeInstalls into .claude/skills of the current project.
Files
Django Security Best Practices
Comprehensive security guidelines for Django applications to protect against common vulnerabilities.
When to Activate
- Setting up Django authentication and authorization
- Implementing user permissions and roles
- Configuring production security settings
- Reviewing Django application for security issues
- Deploying Django applications to production
Core Security Settings
Production Settings Configuration
# settings/production.py
import os
DEBUG = False # CRITICAL: Never use True in production
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
# Security headers
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
SECURE_CONTENT_TYPE_NOSNIFF = True
X_FRAME_OPTIONS = 'DENY'
# HTTPS and Cookies
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SAMESITE = 'Lax'
Sponsors
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Backend & APIs, Security, Python, Databases
- First seen
- Jul 14, 2026
More from affaan-m/ecc
All 263- Git Workflow6K
- Python Testing6K
- Strategic Compact6K
- Design System6K
- Browser Qa6K
- Springboot Security6K
- Search First6K
- Nextjs Turbopack6K
- Brand Voice6K
- Jira Integration6K
- Laravel Tdd6K
- Fastapi Patterns6K
- Remotion Video Creation6K
- React Patterns5.9K
- Perl Security5.9K
- Kotlin Coroutines Flows5.9K
- React Performance5.9K
- Kotlin Patterns5.9K
- Architecture Decision Records5.9K
- Deployment Patterns5.8K
- React Testing5.8K
- Pytorch Patterns5.8K
- Hexagonal Architecture5.8K
- Flutter Dart Code Review5.8K