Overview
FootyCollect uses environment variables for configuration. For local development, create a.env file in the project root or use the .envs/.local/ directory structure for Docker.
Copy
deploy/env.example to .env as a starting point, then customize the values for your environment.Django Core Settings
Core Django configuration options.Django secret key for cryptographic signing. Generate a secure random string.Production: Use a strong random key (50+ characters)Development: Any string is fine
Enable Django debug mode.Production: Must be
FalseDevelopment: TrueComma-separated list of allowed hostnames.Production: Your domain(s)Development: Local addresses
URL path for Django admin interface.For security, consider using a non-standard path in production:
Database
PostgreSQL database configuration.PostgreSQL connection string in URL format.Format: Docker:
postgresql://USER:PASSWORD@HOST:PORT/DATABASEProduction:Database connection pooling lifetime in seconds.Recommended:
60 for productionRedis
Redis cache and Celery message broker configuration.Redis connection string.Format: Docker:
redis://HOST:PORT/DBProduction:API Rate Limiting
Django REST Framework throttle configuration for/api/ endpoints.
Rate limit for authenticated users.Format:
requests/period (e.g., 100/hour, 1000/day)Rate limit for anonymous users.
Security Headers
HTTPS and security header configuration for production.Redirect all HTTP requests to HTTPS.Production:
TrueDevelopment: FalseInclude subdomains in HSTS (HTTP Strict Transport Security) policy.Production:
TrueEnable HSTS preload.Production:
True (submit to hstspreload.org)Prevent MIME type sniffing.Production:
TrueSameSite cookie policy for session cookies.Options:
Strict, Lax, NoneRecommended: LaxSameSite cookie policy for CSRF cookies.Recommended:
LaxReferrer-Policy header value.Recommended:
strict-origin-when-cross-originPermissions-Policy header for controlling browser features.Default disables geolocation, microphone, camera, and payment APIs:
Content Security Policy (CSP)
Content-Security-Policy configuration to prevent XSS attacks.Enable Content Security Policy.Production:
TrueDevelopment: Can be False for easier debuggingAllowed sources for images. Use comma-separated values with quoted keywords.Default includes Gravatar and Football Kit Archive:
Update with your actual S3/R2 bucket domain if using cloud storage.
Default source policy (fallback for other directives).
Allowed sources for JavaScript.Default includes CDN for UI libraries:
Allowed sources for CSS.
Allowed sources for fonts.
Allowed sources for AJAX, WebSockets, and EventSource.
Allowed sources that can embed this site in frames.
Allowed form submission targets.
Email Configuration
Email sending via SendGrid.SendGrid API endpoint URL.
Default “from” address for emails.
“From” address for server error emails.
Prefix added to email subjects.
Error Tracking (Sentry)
Sentry integration for error monitoring and performance tracking.Sentry Data Source Name (DSN) for error reporting.Get from your Sentry project settings.
Environment name for Sentry (production, staging, development).
Percentage of transactions to sample for performance monitoring (0.0-1.0).
0.0 = disabled, 1.0 = 100% of requestsRecommended: 0.1 (10%) for production to limit costsStorage Backend
Media file storage configuration (AWS S3 or Cloudflare R2).Storage backend for media files.Options:
local- Local filesystem (development)aws- Amazon S3r2- Cloudflare R2
AWS S3 Storage
Configuration whenSTORAGE_BACKEND=aws.
AWS IAM access key ID.
AWS IAM secret access key.
S3 bucket name for media files.
AWS region for S3 bucket.
Custom domain for S3 bucket (optional, for CloudFront CDN).
Cloudflare R2 Storage
Configuration whenSTORAGE_BACKEND=r2.
Cloudflare R2 access key ID.
Cloudflare R2 secret access key.
R2 bucket name.
R2 endpoint URL.Format:
https://<account-id>.r2.cloudflarestorage.comR2 region (usually
auto).Custom domain for R2 bucket (optional).
External Image Downloads
Configuration for downloading images from external sources (e.g., Football Kit Archive).Comma-separated list of allowed hostnames for external image downloads (SSRF protection).
FKAPI Integration
Football Kit Archive API configuration.IP address or hostname of the FKAPI server.Required for Football Kit Archive integration.See FKAPI GitHub for setup instructions.
API key for authenticating with FKAPI.
Rotating Proxy
Optional proxy configuration for external image downloads to avoid rate limiting.Proxy server URL.Supports HTTP, HTTPS, and SOCKS5 protocols:
Proxy authentication username (if required).
Proxy authentication password (if required).
Compression
Static file compression configuration.Enable django-compressor for CSS/JS minification.Production:
TrueDevelopment: Can be False for faster buildsExample Configurations
Development (.env)
Production (.env)
Docker Development (.envs/.local/)
.envs/.local/.django:Validation
Run Django’s production deployment checks:- Security settings
- Required environment variables
- Database connectivity
- Static file configuration