Skip to main content
FootyCollect includes several Django management commands for administrative tasks, bulk operations, and system maintenance.

Available commands

Basic usage

All management commands follow Django’s standard pattern:
python manage.py <command_name> [arguments] [options]

Common options

Most commands support these common options:
  • --dry-run - Preview actions without making changes
  • --verbose - Show detailed output
  • --help - Display command help

When to use management commands

Use populate_user_collection to import collections from Football Kit Archive for testing or migrating data.
Use cleanup_orphaned_photos to remove photo files that are no longer referenced in the database, freeing up storage space.
Use setup_beat_schedule after deployment to configure automatic cleanup tasks that run on a schedule.

Running in production

Always use --dry-run first to preview changes before running commands in production.

Docker deployment

Run commands in the Django container:
docker compose -f docker-compose.production.yml exec django python manage.py <command>

Bare metal deployment

Activate the virtual environment first:
cd /var/www/footycollect
source venv/bin/activate
python manage.py <command>

Monitoring command execution

Commands log to Django’s standard logging system. Check logs for detailed execution information:
# Docker
docker compose logs django

# Systemd
journalctl -u gunicorn -f

Next steps