Overview
Thereset_demo management command completely resets the Wagtail Bakery Demo to its initial state. This is a destructive operation that drops all database tables, removes media files, rebuilds the schema, and reloads the initial fixture data.
Usage
Command Arguments
This command does not accept any arguments or options. It runs non-interactively and does not prompt for confirmation.Database Requirements
The command checks the database engine and raises aCommandError if PostgreSQL is not detected:
What It Does
The command executes a complete reset sequence:Remove Media Files
Removes all media files from storage:
- If using S3: Deletes all objects from the S3 bucket
- If using local storage: Deletes all Image and Document model instances
Reset Database Schema
Drops all database tables using
reset_schema command (requires django-extensions)Example Usage
Reset Development Environment
Reset Before Demo or Testing
Source Code Location
bakerydemo/base/management/commands/reset_demo.py
Dependencies
This command depends on:Provides the
reset_schema command for dropping all database tables. This must be installed and added to INSTALLED_APPS.The command only works with PostgreSQL databases due to the
reset_schema requirement.Storage Backend Handling
AWS S3 Storage
If using S3 (detected by checking if “s3” is in the storage class name), the command deletes all objects:Local File Storage
For local storage, the command deletes database records for images and documents:With local storage, the physical media files may remain on disk even though database records are deleted. The
load_initial_data command will repopulate the media directory.Workflow Integration
This command is commonly used in deployment and maintenance workflows:Deployment Reset Script
Scheduled Reset (Cron)
Error Handling
PostgreSQL Required Error
load_initial_data with SQLite instead, or switch to PostgreSQL.
Missing django-extensions
INSTALLED_APPS:
Safety Considerations
Best practices:- Only use in development/demo environments
- Backup important data before running if needed
- Verify database connection points to correct environment
- Check
DJANGO_SETTINGS_MODULEenvironment variable - Consider using separate demo database from production
Related Commands
load_initial_data- Load initial fixture data without resetcreate_random_data- Add test data after resetreset_admin_password- Reset admin password only

