Harden production settings safety checks and docs
This commit is contained in:
16
README.md
16
README.md
@ -181,6 +181,12 @@ When `DJANGO_DEBUG=0`, startup fails fast unless:
|
||||
- `DJANGO_ALLOWED_HOSTS` is set
|
||||
- `DJANGO_CSRF_TRUSTED_ORIGINS` is set (for production settings)
|
||||
|
||||
Additional production safety checks:
|
||||
|
||||
- `DJANGO_SECRET_KEY` must be strong and non-default in non-development environments
|
||||
- `DJANGO_ALLOWED_HOSTS` must not contain localhost-style values
|
||||
- `DJANGO_CSRF_TRUSTED_ORIGINS` must be explicit HTTPS origins only (no localhost/http)
|
||||
|
||||
Production settings enable hardened defaults such as:
|
||||
|
||||
- secure cookies
|
||||
@ -188,6 +194,16 @@ Production settings enable hardened defaults such as:
|
||||
- security headers
|
||||
- `ManifestStaticFilesStorage` for static asset integrity/versioning
|
||||
|
||||
### Production Configuration Checklist
|
||||
|
||||
- `DJANGO_SETTINGS_MODULE=config.settings.production`
|
||||
- `DJANGO_ENV=production`
|
||||
- `DJANGO_DEBUG=0`
|
||||
- strong `DJANGO_SECRET_KEY` (unique, non-default, >= 32 chars)
|
||||
- explicit `DJANGO_ALLOWED_HOSTS` (no localhost values)
|
||||
- explicit `DJANGO_CSRF_TRUSTED_ORIGINS` with HTTPS origins only
|
||||
- `DJANGO_SECURE_SSL_REDIRECT=1` and `DJANGO_SECURE_HSTS_SECONDS` set appropriately
|
||||
|
||||
## Superuser and Auth
|
||||
|
||||
Create superuser:
|
||||
|
||||
Reference in New Issue
Block a user