### Start Development Server Source: https://wger.readthedocs.io/en/latest/development/frontend.html Starts the local development server. Access the application at http://localhost:3000. ```bash npm start ``` -------------------------------- ### Build and Install Flatpak Source: https://wger.readthedocs.io/en/latest/development/release.html Build the flatpak application using flatpak-builder, creating a local repository and installing it. The --sandbox and --user flags ensure a secure and user-specific installation. ```bash flatpak-builder --repo=repo --force-clean --sandbox --user --install --install-deps-from=flathub build de.wger.flutter.yml ``` -------------------------------- ### Install Dependencies with uv Source: https://wger.readthedocs.io/en/latest/development/backend.html Synchronize and install project dependencies using uv, then activate the virtual environment. ```bash uv sync uv pip install -e . source .venv/bin/activate ``` -------------------------------- ### Load Initial Data and Start Server Source: https://wger.readthedocs.io/en/latest/development/docker.html Loads exercise and nutrition data, then starts the development server. The default administrator credentials are 'admin'/'adminadmin'. ```bash # pull exercises from wger.de (or other source you have defined) python3 manage.py sync-exercises # pull nutrition information wger load-online-fixtures # finally, this is important, start the actual server! python3 manage.py runserver 0.0.0.0:8000 ``` -------------------------------- ### Install PostgreSQL and Configure Database Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Install the PostgreSQL server and set up a database named 'wger' with a user 'wger' and password 'wger'. Grants all privileges on the database to the user. ```bash sudo apt-get install postgresql sudo su - postgres createdb wger psql wger -c "CREATE USER wger WITH PASSWORD 'wger'" psql wger -c "GRANT ALL PRIVILEGES ON DATABASE wger to wger" ``` -------------------------------- ### Install Dependencies Manually Source: https://wger.readthedocs.io/en/latest/development/backend.html Create a virtual environment, activate it, and install dependencies manually using pip. ```bash python3 -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install --group dev . pip install -e . ``` -------------------------------- ### Hetzner Object Storage Configuration Example Source: https://wger.readthedocs.io/en/latest/administration/storage.html Example environment variables for configuring wger to use Hetzner Object Storage. This setup uses a different domain and region identifier. ```ini AWS_STORAGE_BUCKET_NAME=my-bucket AWS_S3_REGION_NAME=hel1 AWS_S3_DOMAIN=your-objectstorage.com ``` -------------------------------- ### AWS S3 Configuration Example Source: https://wger.readthedocs.io/en/latest/administration/storage.html Example environment variables for configuring wger to use AWS S3 for storage. Adjust bucket name, region, and domain as per your AWS setup. ```ini AWS_STORAGE_BUCKET_NAME=my-bucket AWS_S3_REGION_NAME=eu-central-1 AWS_S3_DOMAIN=amazonaws.com AWS_S3_ENDPOINT_URL=https://s3.eu-central-1.amazonaws.com AWS_S3_CUSTOM_DOMAIN=my-bucket.s3.eu-central-1.amazonaws.com ``` -------------------------------- ### Install Dependencies Source: https://wger.readthedocs.io/en/latest/changelog.html Use this command to install project dependencies after updating requirements. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Yarn and Sass Source: https://wger.readthedocs.io/en/latest/changelog.html Install Yarn and Sass, which are required for building CSS and JS libraries. ```bash sudo npm install -g yarn sass ``` -------------------------------- ### Start Celery Beat Source: https://wger.readthedocs.io/en/latest/development/celery.html Run this command in your virtual environment to start the Celery beat scheduler. ```bash celery -A wger beat -l INFO ``` -------------------------------- ### Install ffmpeg and ffmpeg-python Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Install ffmpeg for video processing and ffmpeg-python for Python integration. These are optional but recommended for enhanced video handling. ```bash apt-get install ffmpeg pip install ffmpeg-python ``` -------------------------------- ### Start wger Services Source: https://wger.readthedocs.io/en/latest/administration/lifecycle.html Starts all wger services that were previously stopped. ```bash docker compose start ``` -------------------------------- ### Install JS/CSS Libraries Source: https://wger.readthedocs.io/en/latest/changelog.html Installs or updates JavaScript and CSS libraries using Yarn. ```bash yarn install ``` -------------------------------- ### Minimal wger Configuration Example Source: https://wger.readthedocs.io/en/latest/installation/from-source.html A minimal example of the wger environment configuration file. Includes essential settings for hosts, secret key, time zone, media/static roots, and database connection. ```ini # /home/wger/wger.env # Change these ALLOWED_HOSTS=example.com,www.example.com DJANGO_SECRET_KEY=your-very-long-and-random-secret-key TIME_ZONE=Europe/Berlin # Application MEDIA_ROOT=/home/wger/media STATIC_ROOT=/home/wger/static # Django Setup DJANGO_SETTINGS_MODULE=settings.main PYTHONPATH=/home/wger/src # Postgres DJANGO_DB_ENGINE=django.db.backends.postgresql DJANGO_DB_NAME=wger DJANGO_DB_USER=wger DJANGO_DB_PASSWORD=wger DJANGO_DB_HOST=localhost DJANGO_DB_PORT=5432 ``` -------------------------------- ### Start Celery Flower Source: https://wger.readthedocs.io/en/latest/development/celery.html Run this command in your virtual environment to start the Celery Flower web application for monitoring tasks. Replace ${CELERY_BROKER} with your broker URL. ```bash celery -A wger --broker="${CELERY_BROKER}" flower ``` -------------------------------- ### Run Flatpak Application Source: https://wger.readthedocs.io/en/latest/development/release.html Launch the installed flatpak version of the wger application. ```bash flatpak run de.wger.flutter ``` -------------------------------- ### Enable and Start Systemd Timer Source: https://wger.readthedocs.io/en/latest/administration/powersync.html Commands to enable and start the systemd timer for PowerSync compaction, followed by verification commands. ```bash systemctl daemon-reload systemctl enable --now wger-powersync-compact.timer systemctl list-timers wger-powersync-compact.timer journalctl -u wger-powersync-compact.service ``` -------------------------------- ### Install Frontend Dependencies Source: https://wger.readthedocs.io/en/latest/development/release.html Install npm dependencies after updating the package.json version for the Django server. ```bash npm install ``` -------------------------------- ### Download Exercise Videos Source: https://wger.readthedocs.io/en/latest/administration/commands.html Synchronizes exercise videos from the default wger instance to the local installation. Existing videos are not overwritten. ```bash python manage.py download-exercise-videos ``` -------------------------------- ### Start Docker Services Source: https://wger.readthedocs.io/en/latest/installation/docker.html Use this command to start all services defined in the docker-compose.yml file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Load Online Fixtures (Ingredients and Units) Source: https://wger.readthedocs.io/en/latest/administration/commands.html Downloads and installs a subset of ingredient and weight unit fixtures from online sources. For a full ingredient sync, use the `sync-ingredients-bulk` management command. ```bash wger load-online-fixtures ``` -------------------------------- ### Bootstrap the Application Source: https://wger.readthedocs.io/en/latest/development/docker.html Executes commands within the Docker container to create initial database tables, install Node.js dependencies, and build frontend assets. ```bash docker compose exec web /bin/bash # this creates initial db tables, runs npm install, npm run build:css:sass, etc wger bootstrap ``` -------------------------------- ### Run Django Development Server Source: https://wger.readthedocs.io/en/latest/development/backend.html Start the Django development server to run the backend application. ```bash python manage.py runserver ``` -------------------------------- ### Bootstrap the wger Application Source: https://wger.readthedocs.io/en/latest/administration/commands.html Initializes the application by creating a settings file, setting up the SQLite database, loading fixtures, and creating a default administrator user. This command is used for initial setup on a new system. ```bash wger bootstrap ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Clone the wger repository into the specified directory and install dependencies using uv with the 'docker' group. The --no-managed-python flag uses the system's Python. ```bash git clone https://github.com/wger-project/wger.git /home/wger/src cd /home/wger/src uv sync --group docker --no-managed-python ``` -------------------------------- ### Setup PowerSync Storage Source: https://wger.readthedocs.io/en/latest/administration/powersync.html Run this command once to create the necessary Postgres role and schema for PowerSync. It reads connection details from PS_STORAGE_PG_URI and is safe to re-run. ```bash docker compose exec web ./manage.py setup-powersync-storage ``` -------------------------------- ### Superset Example Output Source: https://wger.readthedocs.io/en/latest/api/routines.html Illustrates the interleaved output for a superset with multiple exercises having different set counts. ```text Exercise 1 Exercise 2 Exercise 3 Exercise 1 Exercise 2 Exercise 3 Exercise 1 Exercise 3 Exercise 1 ``` -------------------------------- ### Install Flatpak Builder Dependencies Source: https://wger.readthedocs.io/en/latest/development/release.html Install the elfutils package, which may be required by flatpak-builder. Also, add the flathub remote repository if it's not already present. ```bash sudo apt install elfutils flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ``` -------------------------------- ### Load Ingredient Fixtures Source: https://wger.readthedocs.io/en/latest/administration/sync-data.html Load a smaller base set of ingredients for a quick start, or the full dataset for comprehensive data. ```bash docker compose exec web wger load-online-fixtures ``` ```bash # On a fresh install: docker compose exec web ./manage.py sync-ingredients-bulk --set-mode insert # On an existing install (preserves your additions): docker compose exec web ./manage.py sync-ingredients-bulk --set-mode update ``` -------------------------------- ### Install Node Dependencies Source: https://wger.readthedocs.io/en/latest/development/frontend.html Installs project dependencies using npm. Ensure Node.js version is greater than 22. ```bash npm install ``` -------------------------------- ### Start Celery Worker for Development Source: https://wger.readthedocs.io/en/latest/development/celery.html Run this command in your virtual environment to start the Celery worker for development purposes. Use -l INFO for detailed logging. ```bash celery -A wger worker -l INFO ``` -------------------------------- ### Reload and Start gunicorn Service Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Commands to reload systemd configuration and then enable and start the gunicorn service. ```bash sudo systemctl daemon-reload sudo systemctl enable --now wger ``` -------------------------------- ### Install Bower Components Source: https://wger.readthedocs.io/en/latest/changelog.html Install static assets using Bower. This command is necessary after changes to JS package management and requires deleting the old components directory. ```python python manage.py bower install ``` -------------------------------- ### Download Exercise Images Source: https://wger.readthedocs.io/en/latest/administration/commands.html Synchronizes exercise images from the default wger instance to the local installation. Existing images are not overwritten. ```bash python manage.py download-exercise-images ``` -------------------------------- ### Update wger from Source Source: https://wger.readthedocs.io/en/latest/administration/updating.html Follow these commands to update wger when installed from source. This includes pulling the latest code, installing dependencies, applying migrations, and collecting static files. ```bash git pull pip install . python manage.py migrate --all npm install npm run build:css:sass python manage.py collectstatic ``` -------------------------------- ### Create Celery Configuration Directory Source: https://wger.readthedocs.io/en/latest/development/celery.html Create a directory to store Celery configuration files. This is part of the manual setup for production. ```bash mkdir /home/wger/celery/ ``` -------------------------------- ### Run Enhanced Development Server Source: https://wger.readthedocs.io/en/latest/development/backend.html Install django-extensions and use `runserver_plus` for an enhanced development server with an interactive debugger. ```bash pip install django_extensions werkzeug python manage.py runserver_plus [options] ``` -------------------------------- ### Get Help for a Specific wger Command Source: https://wger.readthedocs.io/en/latest/administration/commands.html Use `wger --help ` to get help on a specific administration command. ```bash wger --help ``` -------------------------------- ### List All wger Commands Source: https://wger.readthedocs.io/en/latest/administration/commands.html Call `wger` without any arguments to get a list of all available administration commands. ```bash wger ``` -------------------------------- ### Get Help for Dummy Generator Scripts Source: https://wger.readthedocs.io/en/latest/development/dummy_data.html Access help information for specific dummy generator scripts by appending the --help flag. This shows available options and usage for a given generator. ```bash python3 manage.py dummy-generator- --help ``` -------------------------------- ### Manage wger Systemd Service Source: https://wger.readthedocs.io/en/latest/administration/lifecycle.html Commands to reload systemd configuration, start the wger service, and enable it to auto-start on server reboot. ```bash systemctl daemon-reload systemctl start wger ``` ```bash systemctl enable wger ``` -------------------------------- ### Progression Rule Requirements Example Source: https://wger.readthedocs.io/en/latest/api/routines.html Defines the requirements for a progression rule to be applied, specifying which fields must be met in the previous iteration. ```json { "rules": [ "weight", "repetitions", "rir", "rest" ] } ``` -------------------------------- ### Synchronize Ingredients in Bulk Source: https://wger.readthedocs.io/en/latest/administration/commands.html Synchronizes the ingredient database from the default wger instance to the local installation. This is the recommended method for updating ingredients. Manual additions are preserved. Options include `update` or `replace` mode. ```bash python manage.py sync-ingredients-bulk --set-mode=update ``` ```bash python manage.py sync-ingredients-bulk --set-mode=replace ``` -------------------------------- ### Manage Celery Beat Service Source: https://wger.readthedocs.io/en/latest/development/celery.html Commands to reload systemd configuration and start the Celery beat service after creating or modifying its service file. ```bash systemctl daemon-reload systemctl start celery-beat ``` -------------------------------- ### Start Docker Compose Watch Source: https://wger.readthedocs.io/en/latest/development/docker.html Initiates Docker Compose in watch mode, which automatically syncs code changes to the container and rebuilds the image as needed. ```bash docker compose up --watch ``` -------------------------------- ### Configure wger Systemd Service Source: https://wger.readthedocs.io/en/latest/administration/lifecycle.html Defines a systemd service file to manage the wger Docker Compose installation, enabling it to start automatically on server reboots. ```systemd [Unit] Description=wger docker compose service PartOf=docker.service After=docker.service [Service] Type=oneshot RemainAfterExit=true WorkingDirectory=/path/to/the/docker/compose/ ExecStart=/usr/bin/docker compose up -d --remove-orphans ExecStop=/usr/bin/docker compose down [Install] WantedBy=multi-user.target ``` -------------------------------- ### Extend Environment Files Source: https://wger.readthedocs.io/en/latest/installation/docker.html Specify additional environment files for a service in docker-compose.override.yml. This example adds './config/my.env' after './config/prod.env' for the web service. ```yaml web: env_file: - ./config/prod.env - ./config/my.env ``` -------------------------------- ### Clone Repositories and Set Up Environment Source: https://wger.readthedocs.io/en/latest/development/docker.html Clone the Docker and wger repositories, navigate to the development environment, and configure the .env file with the correct WGER_CODEPATH. ```bash git clone https://github.com/wger-project/docker git clone https://github.com/wger-project/wger cd docker/dev cp .env.example .env echo "WGER_CODEPATH=/my/wger/path" > .env ``` -------------------------------- ### Schedule PowerSync Compaction with Cron Source: https://wger.readthedocs.io/en/latest/administration/powersync.html Example cron job configuration for daily PowerSync compaction. The -T flag disables TTY allocation, which is required for cron. ```cron # /etc/cron.d/wger-powersync-compact 0 3 * * * root cd /path/to/wger/docker && docker compose run --rm -T powersync compact >>/var/log/wger-compact.log 2>&1 ``` -------------------------------- ### Bootstrap and Load Fixtures Source: https://wger.readthedocs.io/en/latest/development/backend.html Set the Django settings module and run bootstrap commands to create the database and load initial data. ```bash export DJANGO_SETTINGS_MODULE=settings.local_dev wger bootstrap wger load-online-fixtures ``` -------------------------------- ### Create Static and Media Folders Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Create directories for static files and user uploads. Ensures the media directory is writable by others. ```bash mkdir /home/wger/{static,media} chmod o+w /home/wger/media ``` -------------------------------- ### Sync Exercises and Media Source: https://wger.readthedocs.io/en/latest/administration/sync-data.html Use these commands to sync exercises, download exercise images, and download exercise videos from wger.de. ```bash docker compose exec web python3 manage.py sync-exercises docker compose exec web python3 manage.py download-exercise-images docker compose exec web python3 manage.py download-exercise-videos ``` -------------------------------- ### Database Migration Source: https://wger.readthedocs.io/en/latest/changelog.html Run this command to apply database schema changes. ```bash python manage.py migrate ``` -------------------------------- ### Create and Set Permissions for SQLite Database Source: https://wger.readthedocs.io/en/latest/administration/storage.html Use these commands to create an empty SQLite database file and set the correct file permissions. Ensure the file is accessible by the wger services. ```bash touch ./database.sqlite chmod 664 ./database.sqlite ``` -------------------------------- ### Get Help for a Specific Django Management Command Source: https://wger.readthedocs.io/en/latest/administration/commands.html Use `python manage.py --help` to get help on a specific Django management command. ```bash python manage.py --help ``` -------------------------------- ### Configure SQLite Database Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Set up a directory for SQLite database files and create an empty database file. Ensures the directory and file are writable by the 'www-data' group. ```bash mkdir /home/wger/db touch /home/wger/db/database.sqlite chown :www-data -R /home/wger/db chmod g+w /home/wger/db /home/wger/db/database.sqlite ``` -------------------------------- ### Improved Cache Handling Source: https://wger.readthedocs.io/en/latest/changelog.html Example of improved cache handling, likely related to performance optimizations. ```python # Improved cache handling #246 (thanks @louiCoder) ``` -------------------------------- ### Get Routine Logs Source: https://wger.readthedocs.io/en/latest/api/routines.html Retrieves workout sessions and logs associated with a specific routine, grouped by session. ```APIDOC ## GET /api/v2/routine/{id}/logs/ ### Description Fetches the workout sessions and logs pertaining to a given routine. The data is organized and grouped by individual workout sessions. ### Method GET ### Endpoint /api/v2/routine/{id}/logs/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the routine. ``` -------------------------------- ### Upgrade Steps from 2.2 Source: https://wger.readthedocs.io/en/latest/changelog.html These commands outline the necessary steps to upgrade from version 2.2 to 2.3, including updating Python libraries, migrating the database, and updating static files. ```bash pip3 install -r requirements.txt ``` ```bash python manage.py migrate ``` ```bash yarn install ``` ```bash yarn build:css:sass ``` ```bash python3 manage.py collectstatic ``` -------------------------------- ### Configure S3 Static Files Source: https://wger.readthedocs.io/en/latest/administration/storage.html Enable S3-backed static file storage by setting USE_S3_STATIC_FILES to true. Remember to set DJANGO_COLLECTSTATIC_ON_STARTUP to false to avoid unnecessary startup delays. ```ini USE_S3_STATIC_FILES=True DJANGO_COLLECTSTATIC_ON_STARTUP=False ``` -------------------------------- ### Exercise API - Get Base Info Source: https://wger.readthedocs.io/en/latest/changelog.html New endpoint to retrieve exercise information grouped by the base exercise. ```http /exercisebaseinfo/ ``` -------------------------------- ### Backup SQLite Database Source: https://wger.readthedocs.io/en/latest/development/backend.html Create a backup of the SQLite database after the initial bootstrap. ```bash cp database.sqlite database.sqlite.orig ``` -------------------------------- ### Disable WebAuthn MFA factor Source: https://wger.readthedocs.io/en/latest/administration/mfa.html To run without WebAuthn, for example on an HTTP-only instance, set MFA_SUPPORTED_TYPES to exclude webauthn. ```bash MFA_SUPPORTED_TYPES=totp,recovery_codes ``` -------------------------------- ### Sync Exercises and Download Media Source: https://wger.readthedocs.io/en/latest/development/docker.html Synchronizes exercise data from the remote source and downloads associated images and videos. ```bash # Sync exercises python3 manage.py sync-exercises python3 manage.py download-exercise-images python3 manage.py download-exercise-videos ``` -------------------------------- ### Format Code with Ruff Source: https://wger.readthedocs.io/en/latest/development/backend.html Format the project's code according to the configured style using Ruff. ```bash ruff format ``` -------------------------------- ### Run Database Migrations Source: https://wger.readthedocs.io/en/latest/changelog.html Apply database schema changes required for the new version. ```bash python3 manage.py migrate ``` -------------------------------- ### Override Nginx Port Source: https://wger.readthedocs.io/en/latest/installation/docker.html Create a docker-compose.override.yml file to change the port the Nginx service exposes. This example changes it to port 8080. ```yaml services: nginx: ports: - "8080:80" ``` -------------------------------- ### Load Fixture Data Source: https://wger.readthedocs.io/en/latest/administration/commands.html Loads all necessary fixture files containing default application data such as exercises, muscles, equipment, ingredients, units, and languages. Note that ingredients are not included and require a separate command. ```bash wger load-fixtures ``` -------------------------------- ### Activate Virtual Environment Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Activate the Python virtual environment created by uv. This is necessary before running bootstrap commands. ```bash source /home/wger/src/.venv/bin/activate ``` -------------------------------- ### Synchronize Ingredients via API (Slower) Source: https://wger.readthedocs.io/en/latest/administration/commands.html Synchronizes ingredients using the API, which is slower than bulk download but maintained for compatibility. The `-async` version uses Celery for background processing. ```bash python manage.py sync-ingredients[-async] ``` -------------------------------- ### Get Routine Structure Source: https://wger.readthedocs.io/en/latest/api/routines.html Retrieves the full nested structure of a routine, including days, slots, and slot entries. This is suitable for use in an editor interface. ```APIDOC ## GET /api/v2/routine/{id}/structure/ ### Description Retrieves the complete nested structure of a routine, from routine to days, slots, and slot entries. This endpoint is designed for use in an editor. ### Method GET ### Endpoint /api/v2/routine/{id}/structure/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the routine. ``` -------------------------------- ### Create GitHub Release Source: https://wger.readthedocs.io/en/latest/development/release.html Create a new release on GitHub from the tag. Use the '--generate-notes' flag to automatically create the description from pull requests. ```bash gh release create "X.Y" --generate-notes ``` -------------------------------- ### Generate ED25519 Private Key Source: https://wger.readthedocs.io/en/latest/administration/anubis.html Generate a private key for Anubis to sign challenge cookies. Ensure this key is unique and not reused from example values. ```bash openssl rand -hex 32 ``` -------------------------------- ### Get Routine Date Sequence Gym Source: https://wger.readthedocs.io/en/latest/api/routines.html Provides the same data as the date-sequence-display endpoint, but splits slots into individual sets and interleaves supersets. This is optimized for a gym-mode view. ```APIDOC ## GET /api/v2/routine/{id}/date-sequence-gym/ ### Description Returns routine data similar to the date-sequence-display endpoint, but with slots broken down into individual sets and supersets interleaved. This format is intended for a gym-mode view. ### Method GET ### Endpoint /api/v2/routine/{id}/date-sequence-gym/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the routine. ``` -------------------------------- ### Link Local React Repository Source: https://wger.readthedocs.io/en/latest/development/frontend.html Links a local React repository to the Wger server for instant change visibility during development. Navigate to the respective directories and run the commands. ```bash cd /path/to/react/repo npm link cd /path/to/wger/server npm link @wger-project/react-components ``` -------------------------------- ### Get Routine Date Sequence Display Source: https://wger.readthedocs.io/en/latest/api/routines.html Returns a sequence of dates for a routine, with associated days and slots resolved. Slots with repeated exercises are consolidated for display. ```APIDOC ## GET /api/v2/routine/{id}/date-sequence-display/ ### Description Provides a date-by-date sequence of a routine, resolving the associated days and slots. Slots containing repeated sets of the same exercise are combined for a cleaner display. ### Method GET ### Endpoint /api/v2/routine/{id}/date-sequence-display/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the routine. ``` -------------------------------- ### Truncate Media Tables and Download Images/Videos Source: https://wger.readthedocs.io/en/latest/administration/backup.html Truncates tables related to exercise images and videos, then downloads them from the upstream instance. Use this if you haven't uploaded your own media and need to re-sync. ```bash docker compose exec db psql -U wger -c "TRUNCATE TABLE exercises_exerciseimage, exercises_exercisevideo;" docker compose exec db psql -U wger -c "TRUNCATE TABLE nutrition_image;" docker compose exec web python3 manage.py download-exercise-images docker compose exec web python3 manage.py download-exercise-videos ``` -------------------------------- ### Authenticate API Request with JWT Source: https://wger.readthedocs.io/en/latest/api/api.html Include the obtained access token in the Authorization header as a Bearer token for authenticated API requests. This example demonstrates fetching routines. ```python result = requests.get( 'https://wger.de/api/v2/routine/', headers={'Authorization': f'Bearer {access_token}'} ) print(result.json()) ``` -------------------------------- ### Run wger Bootstrap Script Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Execute the wger bootstrap command to download necessary JS/CSS libraries and load initial data into the application. ```bash wger bootstrap ``` -------------------------------- ### Modify Settings for Immediate Effect Source: https://wger.readthedocs.io/en/latest/development/docker.html Demonstrates how to directly modify settings in `settings.py` for immediate effect in the development server, bypassing the need to restart the container for environment variable changes. ```python WGER_SETTINGS["EXERCISE_CACHE_TTL"] = env.int("EXERCISE_CACHE_TTL", 3600) # This can be changed to: WGER_SETTINGS["EXERCISE_CACHE_TTL"] = 123 ``` -------------------------------- ### Run All Backend Tests Source: https://wger.readthedocs.io/en/latest/development/backend.html Execute the full test suite for the backend application using Django's test runner. ```bash python manage.py test ``` -------------------------------- ### Docker Compose Override for Template Customization Source: https://wger.readthedocs.io/en/latest/administration/settings.html Mount custom template files (e.g., tos.html, about.html) into the Wger Docker container using a docker-compose.override.yml file. This is the simplest method for Docker setups. ```yaml services: web: volumes: - ./my-tos.html:/home/wger/src/wger/software/templates/tos.html:ro - ./my-about.html:/home/wger/src/wger/core/templates/misc/about.html:ro ``` -------------------------------- ### Create New Language PO File Source: https://wger.readthedocs.io/en/latest/development/i18n.html Use this command to create a new .po file for a specific language. Replace 'fr' with the desired ISO 639-1 language code. ```bash django-admin makemessages --extension py,html,tpl -l fr ``` -------------------------------- ### Import Off Products Source: https://wger.readthedocs.io/en/latest/administration/commands.html Imports and updates products from the Open Food Facts database. This command is not intended for regular use on local installations to avoid overloading Open Food Facts servers. Use `sync-ingredients-bulk` for regular updates. ```bash python manage.py import-off-products ``` -------------------------------- ### Copy Database to Host Source: https://wger.readthedocs.io/en/latest/development/docker.html Copies the SQLite database file from the Docker container to the host machine's wger path. It's recommended to back up the database after copying. ```bash docker compose cp web:/home/wger/src/database.sqlite /my/wger/path # at this time you can make a backup if you want such that if you mess # something up, you don't have to start from scratch (just copy orig back) cd /my/wger/path cp database.sqlite database.sqlite.orig ``` -------------------------------- ### Obtain JWT Tokens via Login Endpoint Source: https://wger.readthedocs.io/en/latest/api/api.html Use this method to get access and refresh tokens by sending username and password to the login endpoint. This is recommended for applications with a login UI or scripts targeting accounts without 2FA. ```python result = requests.post( 'https://wger.de/allauth/app/v1/auth/login', json={'username': 'user', 'password': 'admin'}, ) data = result.json()['data'] access_token = data['access'] refresh_token = data['refresh'] ``` -------------------------------- ### Get Routine Statistics Source: https://wger.readthedocs.io/en/latest/api/routines.html Calculates and returns aggregated statistics from workout logs for a routine, including volume, set count, and estimated 1RM. Statistics can be broken down by day, week, iteration, or the whole routine, and further split by body part or exercise. ```APIDOC ## GET /api/v2/routine/{id}/stats/ ### Description Retrieves aggregated statistics derived from the workout logs of a routine. This includes metrics like volume, set count, and estimated 1RM (using the Brzycki formula). Statistics can be segmented by day, ISO week, iteration, or the entire routine, and further categorized by total, upper/lower body, per muscle, and per exercise. ### Method GET ### Endpoint /api/v2/routine/{id}/stats/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the routine. ``` -------------------------------- ### Build Release App Bundle Source: https://wger.readthedocs.io/en/latest/development/release.html Build the release version of the Android App Bundle for testing. ```bash flutter build appbundle --release ``` -------------------------------- ### Load Permissions Data Source: https://wger.readthedocs.io/en/latest/changelog.html Loads initial permission data from JSON fixtures. ```bash python3 manage.py loaddata groups.json categories.json ``` -------------------------------- ### Caddyfile Configuration to Bypass API Authentication Source: https://wger.readthedocs.io/en/latest/administration/auth_proxy.html Configure Caddy to bypass authentication for the `/api/*` path, allowing mobile apps to access API endpoints using an API key. This setup ensures that only the specified API path is proxied directly, while other paths are subject to authentication. ```caddy wger.example.com { import cert # allow api path to bypass auth (requires api key) handle /api/* { reverse_proxy wger_server:8000 } # Enclosing in `route` forces execution order route { # Forward outpost path to actual outpost reverse_proxy /outpost.goauthentik.io/* authentik_server:9000 ... } ``` -------------------------------- ### Run Vitest Test Suite Source: https://wger.readthedocs.io/en/latest/development/frontend.html Executes the component test suite using Vitest. ```bash npm run test ``` -------------------------------- ### Override Caddy Systemd Unit to Disable ProtectHome Source: https://wger.readthedocs.io/en/latest/installation/from-source.html If static or media files return 403/404 errors, override the Caddy systemd unit to disable ProtectHome, which might block access to /home/wger. ```systemd [Service] ProtectHome=off ``` -------------------------------- ### Test Android Release Configuration with Fastlane Source: https://wger.readthedocs.io/en/latest/development/release.html Execute a dry-run of the Android release configuration using Fastlane to test the publishing process without uploading. ```bash bundle exec fastlane android test_configuration ``` -------------------------------- ### Configure S3 Media Files Source: https://wger.readthedocs.io/en/latest/administration/storage.html Enable S3-backed media storage by setting USE_S3_MEDIA_FILES to true. This directs wger to store and retrieve media files from an S3-compatible object store. ```ini USE_S3_MEDIA_FILES=True ``` -------------------------------- ### Caddyfile Configuration Source: https://wger.readthedocs.io/en/latest/installation/from-source.html Configuration file for Caddy, setting up reverse proxy to gunicorn and serving static/media files. Ensure your domain's DNS points to your server for automatic SSL. ```caddy your-domain.example.com { encode reverse_proxy 127.0.0.1:8000 { header_up Host {host} header_up X-Real-IP {remote_host} header_up X-Forwarded-For {http.X-Forwarded-For} {remote_host} header_up X-Forwarded-Proto {scheme} header_up X-Http-Version {http.request.proto} } handle /static/* { root * /home/wger header Cache-Control "public, max-age=31536000, immutable" file_server } handle /media/* { root * /home/wger file_server } } ``` -------------------------------- ### Collect Static Files Source: https://wger.readthedocs.io/en/latest/changelog.html Execute this command to gather static files, typically for production environments. ```bash python manage.py collectstatic ``` -------------------------------- ### Generate Dummy Data for Various Entry Types Source: https://wger.readthedocs.io/en/latest/development/dummy_data.html Use these commands to generate specific types of dummy data for testing. Each command corresponds to a different data category. ```bash dummy-generator-users dummy-generator-gyms dummy-generator-body-weight dummy-generator-nutrition dummy-generator-measurement-categories dummy-generator-measurements dummy-generator-workout-plans dummy-generator-workout-diary ``` -------------------------------- ### Generate Dummy Data Source: https://wger.readthedocs.io/en/latest/administration/commands.html Use these commands to generate dummy data for various entry types. Refer to the Dummy data section for more information. ```bash python manage.py dummy-generator-* ``` -------------------------------- ### Send Test Email Command Source: https://wger.readthedocs.io/en/latest/administration/settings.html Use this command to verify your email configuration. For Docker deployments, use the provided alternative command. ```python python manage.py sendtestemail user@example.com ``` ```bash docker compose exec web python3 manage.py sendtestemail … ``` -------------------------------- ### Run PowerSync Compaction Source: https://wger.readthedocs.io/en/latest/administration/powersync.html Invoke the compaction subcommand in a one-off PowerSync container to manage the growth of operation logs. This runs online, allowing clients to continue syncing. ```bash docker compose run --rm powersync compact ``` -------------------------------- ### View wger Logs Source: https://wger.readthedocs.io/en/latest/administration/lifecycle.html Displays the logs from wger services in real-time. ```bash docker compose logs -f ```