Apostolos
Apostolos

Reputation: 8101

S3 and django-storages, not recognizing credentials

I am trying to use django-storages with heroku and S3. So I followed the tutorial from readthedocs. I installed everything as it says, I took my ID and Secret Key from Amazon console, and tried the following codes:

settings.py

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = 'key_id'
AWS_ACCESS_SECRET_KEY = 'secret_key'
AWS_STORAGE_BUCKET_NAME = 'mybucket' 


from django.core.files.storage import default_storage
>>> default_storage.__class__
<class 'django.core.files.storage.DefaultStorage'>

I don't know if this is normal return value. I then did the following

default_storage.connection

and I get the following exception

NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials

Is there something wrong with my setup? The code is run locally. Want to test it locally first and then upload it to heroku

EDIT: I used console to manually connect to my s3 using id and secret key and worked fine. This is what I did

import boto
boto.s3_connect(id, key)

and worked. So what could be the problem?Django?

Upvotes: 1

Views: 907

Answers (1)

Apostolos
Apostolos

Reputation: 8101

Found the Solution. Misspelled the key varible. just changed AWS_ACCESS_SECRET_KEY to AWS_SECRET_ACCESS_KEY and everything worked as it should

Upvotes: 1

Related Questions