Reputation: 29795
I recently upgraded to Django 3 and installed a new virtual environment.
I installed all the dependent modules until I got to boto.
I installed django storages with the following command:
pip3 install django-storages
I still received the error:
File "custom_storage.py", line 2, in <module>
from storages.backends.s3boto import S3BotoStorage
ModuleNotFoundError: No module named 'storages.backends.s3boto'
Here is what my custom_storages.py looks like:
from storages.backends.s3boto import S3BotoStorage
class StaticStorage(S3BotoStorage):
location = settings.STATICFILES_LOCATION
class MediaStorage(S3BotoStorage):
location = settings.MEDIAFILES_LOCATION
I then tried to install boot directly with the following command:
pip3 install boto3
I still get the above error.
Is there anything else needed to be installed to get past this error?
Upvotes: 3
Views: 7582
Reputation: 22841
It looks like django-storages
is alive again, but the backend in settings.py
should now be 'storages.backends.s3boto3.S3Boto3Storage'
.
Upvotes: 2
Reputation: 5230
from storages.backends.s3boto import S3BotoStorage
should now be
from storages.backends.s3boto3 import S3Boto3Storage
Upvotes: 4
Reputation: 29795
It looks like django-storages is no longer being maintained.
I installed redux instead:
pip3 install django-storages-redux
There are then compatibility issues with Django 3 and Redux. I then changed the following files:
sudo vi /venv/lib/python3.7/site-packages/storages/compat.py
Line 1 and 2 should remove references to "Six" and should now read:
from urllib import parse as urlparse
from io import BytesIO
I then changed line 14 and 15 in the file:
venv/lib/python3.7/site-packages/storages/backends/s3boto3.py
They should now read:
from io import BytesIO
from urllib import parse as urlparse
Upvotes: 3
Reputation: 3832
Try out these Steps.
Upvotes: 2