fetch_home_kits command fetches kit data from the FKAPI bulk endpoint, downloads and optimizes images to AVIF format, and caches the data for use by the home page view.
How it works
Basic usage
Storage backends
The command supports both local and remote storage:- Local storage: Files saved to
MEDIA_ROOT/home_kits/ - Cloud storage: Files uploaded to S3/R2 via Django’s
default_storage
Storage paths
- Kit data:
home_kits/home_kits_data.json - Kit images:
home_kits/<kit_slug>.avif - Club/brand logos:
home_kits/logos/<entity>_<slug>.avif
Configuration
The command requires:- FKAPI running: See FKAPI Integration
- Kit slugs file:
footycollect/static/data/home_kits_slugs.json
Kit slugs format
Proxy support
For downloading images through a rotating proxy, configure:Example workflow
Create slugs file
Create or update
footycollect/static/data/home_kits_slugs.json with desired kit slugsOutput example
Image optimization
All images are automatically optimized:- Converted to AVIF format for smaller file size
- Compressed using
optimize_image()utility - Transparency preserved where applicable
AVIF images are typically 50-70% smaller than JPEG while maintaining quality.
Scheduling
For production, schedule this command to keep homepage kits fresh:Troubleshooting
FKAPI connection error
FKAPI connection error
Verify FKAPI is running:Check environment variables:
Slugs file not found
Slugs file not found
Ensure the file exists at the correct path:Create it if missing with valid kit slugs from Football Kit Archive.
Image download failures
Image download failures
Check network connectivity and proxy configuration. Images are fetched from Football Kit Archive CDN.If using a proxy, verify credentials:
Storage errors
Storage errors
For remote storage (S3/R2), verify credentials: