4.2x Netbox version breaks Django-storage STORAGE_BACKEND #10652

Closed
opened 2025-12-29 21:34:11 +01:00 by adam · 2 comments
Owner

Originally created by @JHirvi on GitHub (Jan 15, 2025).

Originally assigned to: @bctiemann on GitHub.

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.2.1

Python Version

3.12

Steps to Reproduce

After upgrading netbox 4.1.7 to 4.2.1 Netbox ignored django storage package for storing media files to S3.

Expected Behavior

Before upgrade all media files were succesfully stored in S3 and no modifications were done in that package or definments in extra.py file.

Observed Behavior

No errors in logs and all new media files are stored now in local storage instead of S3-bucket.

I believe that issue is related to django version upgrade to 5.1.

I found that Django 5.1 does not support DEFAULT_FILE_STORAGE parameter what is still in use in settings.py file.

if STORAGE_BACKEND is not None: DEFAULT_FILE_STORAGE = STORAGE_BACKEND # django-storages if STORAGE_BACKEND.startswith('storages.'):

https://forum.djangoproject.com/t/deprecation-of-default-file-storage-can-we-easen-the-migration/34284

Some discussion related to Django version 5.1 upgrade and backend storage parameters. 
Originally created by @JHirvi on GitHub (Jan 15, 2025). Originally assigned to: @bctiemann on GitHub. ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.2.1 ### Python Version 3.12 ### Steps to Reproduce After upgrading netbox 4.1.7 to 4.2.1 Netbox ignored django storage package for storing media files to S3. ### Expected Behavior Before upgrade all media files were succesfully stored in S3 and no modifications were done in that package or definments in extra.py file. ### Observed Behavior No errors in logs and all new media files are stored now in local storage instead of S3-bucket. I believe that issue is related to django version upgrade to 5.1. I found that Django 5.1 does not support DEFAULT_FILE_STORAGE parameter what is still in use in settings.py file. `if STORAGE_BACKEND is not None: DEFAULT_FILE_STORAGE = STORAGE_BACKEND # django-storages if STORAGE_BACKEND.startswith('storages.'):` https://forum.djangoproject.com/t/deprecation-of-default-file-storage-can-we-easen-the-migration/34284 Some discussion related to Django version 5.1 upgrade and backend storage parameters.
adam added the type: bugstatus: acceptedseverity: high labels 2025-12-29 21:34:11 +01:00
adam closed this issue 2025-12-29 21:34:11 +01:00
Author
Owner

@bctiemann commented on GitHub (Jan 15, 2025):

@JHirvi the linked PR should fix this; I've tested it as well as I can locally without an S3 setup. Can you verify whether it solves the issue?

@bctiemann commented on GitHub (Jan 15, 2025): @JHirvi the linked PR should fix this; I've tested it as well as I can locally without an S3 setup. Can you verify whether it solves the issue?
Author
Owner

@JHirvi commented on GitHub (Jan 16, 2025):

@bctiemann Tested your PR and seems like it is working now backend accepts django storage package as storage_backend and storage_configs are applied too.

Also media files are stored again in S3 and previosly stored images are working too.

@JHirvi commented on GitHub (Jan 16, 2025): @bctiemann Tested your PR and seems like it is working now backend accepts django storage package as storage_backend and storage_configs are applied too. Also media files are stored again in S3 and previosly stored images are working too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10652