Django storages: Import Error - no module named storages
Asked Answered
P

8

21

I'm trying to use Django's storages backend (for BotoS3)

settings.py:

INSTALLED_APPS = (
...
'storages',
...
)

as shown in http://django-storages.readthedocs.org/en/latest/index.html.

and, requirements.txt:

django-storages==1.1.8

But am getting the error:

django.core.exceptions.ImproperlyConfigured: ImportError storages: No module named storages

What am I doing wrong?

Parricide answered 21/4, 2014 at 22:34 Comment(6)
Have you installed django-storages using pip install before or after adding it to the requirements file?Barratry
i had installed it before adding it to re.txt. But I just did a pip install again, and still get the same issue. Does the order make a difference, and if so how so?Parricide
No the order is immaterial, I was just making sure you had actually installed it. Are you in a virtualenv and installing it and running it in after activating the virtualenv?Barratry
d'oh, i'm an idiot! Yep, installing it in virtualenv resolved the issue. If you add that as an answer, I'll accept it.Parricide
We have all been there ;)Barratry
I am getting the "ImportError: No module named storages" after pip installing django-storages in my virtual environment and updating requirements.txt I get the error when running python manage.py collectstaticCrumpler
B
24

There is a possibility that you are in a virtualenv and installing the package outside the virtualenv into the default python installation. Make sure you are not doing that.

Barratry answered 22/4, 2014 at 0:1 Comment(1)
Please include context on how to "Make sure you are not doing that".Sequela
S
13

If you are experiencing this error even though you've included 'storages' in your INSTALLLED_APPS and django-storages in your requirements.txt, check your STATICFILES_STORAGE variable.

For previous versions of django-storages, this should be set as:

STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

For newer versions of django-storages, the package uses boto3 instead of boto and this variable should be set as:

STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

If you're using either version and you've configured your DEFAULT_FILE_STORAGE setting incorrectly, you'll receive an import error.

The correct settings can be found in the django-storages docs

Shoring answered 10/3, 2020 at 23:14 Comment(0)
C
12

I had the same problem. In my case I solved the problem with

pip install django-storages

Collecting django-storages
  Downloading django_storages-1.6.5-py2.py3-none-any.whl (47kB)
    100% |################################| 51kB 358kB/s
Installing collected packages: django-storages
Successfully installed django-storages-1.6.5

It was executed inside my virtual environment.

Condign answered 4/10, 2017 at 13:58 Comment(0)
S
3

I had installed it within virtual env and was running the exact same issue. My problem was that I forgot to update my requirements.txt. So make you update that file!

Sumba answered 24/12, 2016 at 18:11 Comment(0)
P
1

If you are using Pipenv make sure you install django-storages using

pipenv install django-storages

so that the Pipfile and Pipfile.lock are both updated.

I had installed using pip inside the virtualenv and requirements.txt was updated but still receiving this error. After digging around I noticed it was not added to the Pipfile. I ran the installer and it cleared up the error.

Polygon answered 12/3, 2018 at 12:40 Comment(0)
M
1

I installed with: pip install -U django-storages

If you go to venv/lib/python3.8/site-packages/storages/backends you will see no file named S3Boto but S3Boto3. I dropped in an old S3Boto file from an old virtual environment and everything worked again.

Mammalian answered 26/9, 2020 at 4:0 Comment(0)
W
0

I was using virtual environment and installed django-storage as well as boto3 . But still I was getting these errors.

Initially I installed the packages using this command

pip install django-storages, boto3

This command solved my Issue

pip install -U django-storages
pip install -U boto3
  • It updates the packages
Wittenburg answered 15/7, 2020 at 7:9 Comment(0)
M
0

EDX only if you are in local then run this command

paver update_assets --theme-dirs=/edx/app/edxapp/edx-platform/themes/theme-name/
Marandamarasca answered 5/2, 2021 at 7:58 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.