Skip to main content

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.
string
required
Django secret key for cryptographic signing. Generate a secure random string.Production: Use a strong random key (50+ characters)Development: Any string is fine
boolean
default:"False"
Enable Django debug mode.Production: Must be FalseDevelopment: True
Never enable DEBUG in production! It exposes sensitive information.
string
required
Comma-separated list of allowed hostnames.Production: Your domain(s)
Development: Local addresses
string
default:"admin/"
URL path for Django admin interface.For security, consider using a non-standard path in production:

Database

PostgreSQL database configuration.
string
required
PostgreSQL connection string in URL format.Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASEProduction:
Docker:
integer
default:"60"
Database connection pooling lifetime in seconds.Recommended: 60 for production

Redis

Redis cache and Celery message broker configuration.
string
required
Redis connection string.Format: redis://HOST:PORT/DBProduction:
Docker:

API Rate Limiting

Django REST Framework throttle configuration for /api/ endpoints.
string
default:"100/hour"
Rate limit for authenticated users.Format: requests/period (e.g., 100/hour, 1000/day)
string
default:"20/hour"
Rate limit for anonymous users.

Security Headers

HTTPS and security header configuration for production.
boolean
default:"True"
Redirect all HTTP requests to HTTPS.Production: TrueDevelopment: False
boolean
default:"True"
Include subdomains in HSTS (HTTP Strict Transport Security) policy.Production: True
boolean
default:"True"
Enable HSTS preload.Production: True (submit to hstspreload.org)
boolean
default:"True"
Prevent MIME type sniffing.Production: True
SameSite cookie policy for session cookies.Options: Strict, Lax, NoneRecommended: Lax
SameSite cookie policy for CSRF cookies.Recommended: Lax
string
default:"strict-origin-when-cross-origin"
Referrer-Policy header value.Recommended: strict-origin-when-cross-origin
string
Permissions-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.
boolean
default:"True"
Enable Content Security Policy.Production: TrueDevelopment: Can be False for easier debugging
string
Allowed 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.
string
Default source policy (fallback for other directives).
string
Allowed sources for JavaScript.Default includes CDN for UI libraries:
string
Allowed sources for CSS.
string
Allowed sources for fonts.
string
Allowed sources for AJAX, WebSockets, and EventSource.
string
Allowed sources that can embed this site in frames.
string
Allowed form submission targets.

Email Configuration

Email sending via SendGrid.
string
SendGrid API key for sending emails.Get from: https://app.sendgrid.com/settings/api_keys
string
default:"https://api.sendgrid.com/v3/"
SendGrid API endpoint URL.
string
Default “from” address for emails.
string
“From” address for server error emails.
string
default:"[footycollect]"
Prefix added to email subjects.

Error Tracking (Sentry)

Sentry integration for error monitoring and performance tracking.
string
Sentry Data Source Name (DSN) for error reporting.Get from your Sentry project settings.
string
default:"production"
Environment name for Sentry (production, staging, development).
float
default:"0.0"
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 costs

Storage Backend

Media file storage configuration (AWS S3 or Cloudflare R2).
string
default:"local"
Storage backend for media files.Options:
  • local - Local filesystem (development)
  • aws - Amazon S3
  • r2 - Cloudflare R2

AWS S3 Storage

Configuration when STORAGE_BACKEND=aws.
string
AWS IAM access key ID.
string
AWS IAM secret access key.
string
S3 bucket name for media files.
string
default:"us-east-1"
AWS region for S3 bucket.
string
Custom domain for S3 bucket (optional, for CloudFront CDN).

Cloudflare R2 Storage

Configuration when STORAGE_BACKEND=r2.
string
Cloudflare R2 access key ID.
string
Cloudflare R2 secret access key.
string
R2 bucket name.
string
R2 endpoint URL.Format: https://<account-id>.r2.cloudflarestorage.com
string
default:"auto"
R2 region (usually auto).
string
Custom domain for R2 bucket (optional).

External Image Downloads

Configuration for downloading images from external sources (e.g., Football Kit Archive).
string
Comma-separated list of allowed hostnames for external image downloads (SSRF protection).
Only add trusted domains to prevent Server-Side Request Forgery (SSRF) attacks.

FKAPI Integration

Football Kit Archive API configuration.
string
IP address or hostname of the FKAPI server.Required for Football Kit Archive integration.
See FKAPI GitHub for setup instructions.
string
API key for authenticating with FKAPI.

Rotating Proxy

Optional proxy configuration for external image downloads to avoid rate limiting.
string
Proxy server URL.Supports HTTP, HTTPS, and SOCKS5 protocols:
string
Proxy authentication username (if required).
string
Proxy authentication password (if required).

Compression

Static file compression configuration.
boolean
default:"True"
Enable django-compressor for CSS/JS minification.Production: TrueDevelopment: Can be False for faster builds

Example Configurations

Development (.env)

Production (.env)

Docker Development (.envs/.local/)

.envs/.local/.django:
.envs/.local/.postgres:

Validation

Run Django’s production deployment checks:
This validates:
  • Security settings
  • Required environment variables
  • Database connectivity
  • Static file configuration

Next Steps

Local Setup

Manual local installation guide

Docker Setup

Docker Compose development environment

Deployment

Production deployment guide

Development

Learn about the architecture