Skip to main content
The 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

1

Read kit slugs

Reads kit slugs from a JSON file (static/data/home_kits_slugs.json)
2

Fetch from FKAPI

Calls FKAPI bulk endpoint to retrieve kit data
3

Download images

Downloads kit images and compresses them to AVIF format
4

Cache data

Saves kit data and images to storage for fast homepage loading

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

1

Create slugs file

Create or update footycollect/static/data/home_kits_slugs.json with desired kit slugs
2

Run command

3

Verify output

Check that images were downloaded and data file was created:

Output 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:
Or add to Celery Beat:

Troubleshooting

Verify FKAPI is running:
Check environment variables:
Ensure the file exists at the correct path:
Create it if missing with valid kit slugs from Football Kit Archive.
Check network connectivity and proxy configuration. Images are fetched from Football Kit Archive CDN.If using a proxy, verify credentials:
For remote storage (S3/R2), verify credentials:

FKAPI Integration

Learn about FKAPI setup and configuration

Photo Management

Understand image optimization in FootyCollect