Jai Izadi
Jai Izadi

Reputation: 1

Django does not change the default storage system

I have a django application that works perfectly fine with storing media locally. I have decided to change the default storage to be able to store files on a remote cloud system (s3), I set the default storage in my settings.py as below:

DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"

and I verified that this variable is available in django shell:

>>> from django.conf import settings
>>> print(settings.DEFAULT_FILE_STORAGE)
storages.backends.s3boto3.S3Boto3Storage

however, django keeps using the default file storage system (FileSystemStorage):

>>> from django.core.files.storage import default_storage
>>> print(default_storage.__class__.__name__)  # Should print "S3Boto3Storage"
FileSystemStorage
>>> print(default_storage)
<django.core.files.storage.filesystem.FileSystemStorage object at 0x000002A6E6C8FA10>

it is a very simple code and there is no possibility of override of these values in my code, not sure why django does not pick up the default file system provided in settings.py, any idea?

Upvotes: 0

Views: 15

Answers (0)

Related Questions