The project includes a generic bootstrapping script to automate one-time setup tasks, such as seeding a test user or initial data.
- Runs one-time bootstrapping tasks when the app first boots up (e.g., seeding a test user, initial data, etc.).
- Extensible: add more bootstrapping tasks as needed.
src/apps/backend/scripts/bootstrap_app.py
- On startup, if the environment is
developmentorpreview, the backend runs all tasks defined inbootstrap_app.pyif enabled by config. - Each task (such as seeding a test user) is implemented as a function and called from
run_bootstrap_tasks(). - The script is extensible—add more bootstrapping tasks as needed.
- Controlled by the
BOOTSTRAP_APPconfig key (seeconfig/development.yml,config/preview.yml, or your environment variables). - If
BOOTSTRAP_APP: true, the script runs on startup; iffalse, it is skipped.
You can run the script directly for ad-hoc bootstrapping:
cd src/apps/backend && pipenv run python scripts/bootstrap_app.py- Seeding a test user account if
account.create_test_user_accountis enabled in config and the user does not already exist. - Credentials are read from
account.test_userin your environment config.
account:
create_test_user_account: true
test_user:
first_name: 'Dev'
last_name: 'User'
username: 'dev@example.com'
password: 'devpassword'