I have configured AWS S3 to store the static and media files but for some reason it is not working. when i load my site i don’t see css implemented or any photos or videos. That said, if i insepect the page i can see that it is poiting to my S3 bucket with correct url from S3.
The error indicates that the library doesn’t exist. My hunch is that you’re installing dependencies in a different manner than what’s used when you run the app locally. What’s your process for running the application locally? And how did you install storages? Please also verify with pip freeze or your package manager’s equivalent.
running locally i get the error that no module named storages as you mentioned. but how i am getting the right urls when looking at inspect online. I have been trying to solve the issue with no module named storages eventhough i did install it in the same virtual env. how can i see if it is done correctly!
Your settings file isn’t necessary at this point. When you run your app locally, likely via manage.py runserver you don’t have the virtualenv activated where storages is installed.
What command do you run to run the application locally? And where is your virtualenv located?
here i will activate the virtual:
/d/projects/maha (this is where i installed django-storages)
and i then go one more to be in app
cd maha (again) - (here where the manage.py is located)
locally i am getting no module named storages but it is there online in aws s3 site.
$ source venv/bin/activate
$ cd maha
$ pip install -r requirements.txt (is this to create the requirments.txt?)
$ pip install django-storages
$ python manage.py runserver (here it says no module named storages)
Now i can see the css files and photos but still have the error that storages is not definded locally and i think that is why when i tried to add a product (production) that needs to add photo and viedo it is giving me server error 500 because of the storages that is not defined.
Setting AWS_QUERYSTRING_AUTH to False to remove query parameter authentication from generated URLs. This can be useful if your S3 buckets are public.
I wasn’t going to comment since I’m not very knowledgeable on this topic but I just noticed this setting is missing. I’ve but doing my own research to implement s3 I found some issues with the AWS_QUERYSTRING_AUTH depending on if you want your media files public, I haven’t implemented it for static files yet so not sure on the exact config but for public media files AWS_QUERYSTRING_AUTH = False is working for me.
Also here is some useful links on the AWS_QUERYSTRING_AUTH issues with various workarounds: