Skip to content

dbrestore without --input-filename fails when storage backend has location set, despite listbackups showing files #662

@AdamBoleyRacelogic

Description

@AdamBoleyRacelogic

Current Situation

I am using a custom storage backend:
class AzureDatabaseBackupStorage(AzureStorage):
azure_container = "database-backups"
expiration_secs = None
location = settings.AZURE_DATABASE_BACKUP_LOCATION
location is either 'dev', 'staging' or 'production', depending on environment

This is then used in the STORAGES setting dict:
STORAGES = {
"dbbackup": {"BACKEND": "main.storage_backends.AzureDatabaseBackupStorage",}
}

Running python manage.py dbbackup --compress works and saves a backup file to the location directory in the Azure storage container

Running python manage.py listbackup works and lists this file:
Name Datetime
dev/default-2026-01-15-100722.psql.bin.gz 01/15/26 10:07:22

However, running python manage.py dbrestore returns:
CommandError: There's no backup file available.

Running dbrestore with the path specified works, without the location prefix:
python manage.py dbrestore --input-file default-2026-01-15-100722.psql.bin.gz

This suggests that location is correctly prepended when accessing files via 'listbackups, but that the auto-discovery logic in dbrestore` does not do this.

This may be related to #434, which had the same symptom (listbackups shows files but dbrestore says none available) but was caused by custom DBBACKUP_FILENAME_TEMPLATE settings.

I'm not an experienced developer and this is the first time I am using django-dbbackup, so apologies if I've missed something obvious in my configuration. Happy to provide any additional information that would help diagnose this.

Proposed Actions

Make the dbrestore and listbackups commands use the location setting in the same way.

Alternatively, specify in the Storage documentation that sub-directories in Azure storage containers do not work.

Related request - add Azure Blob Storage to Storage documentation.

System Information

django-dbbackup version: 5.1.2
Django version: 5.2.8
Wagtail version: 7.2.1
Python version: 3.14
Storage backend: Azure Blob Storage (via django-storages)
OS: WSL / Linux (Docker container)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions