djangopython-2.7amazon-s3mayanedms

Mayan edms with s3


I am setting up the mayan edms with s3 according to 2nd message of Roberto Rosario on this link (https://groups.google.com/forum/#!topic/mayan-edms/tZjmn5u4y2A) but I am now having some errors.

Even though I added the s3 bucket settings on production.py, the s3.py from the storages/backends/ cannot load the settings.

The following is the error.


File "/home/proj/mayan-edms/lib/python2.7/site-packages/mayan/settings/production.py", line 42, in <module>
from storages.backends.s3 import S3Storage
File "/home/proj/mayan-edms/lib/python2.7/site-packages/storages/backends/s3.py", line 42, in <module>
class S3Storage(Storage):
File "/home/proj/mayan-edms/lib/python2.7/site-packages/storages/backends/s3.py", line 45, in S3Storage
def __init__(self, bucket=settings.AWS_STORAGE_BUCKET_NAME,
File "/home/proj/mayan-edms/lib/python2.7/site-packages/django/conf/__init__.py", line 49, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'AWS_STORAGE_BUCKET_NAME'

And the settings on production.py looks like this.


from django.conf import settings
settings.INSTALLED_APPS += ('storages',)

AWS_ACCESS_KEY_ID = 'KEY_ID'
AWS_SECRET_ACCESS_KEY = 'ACCESS_KEY'
AWS_STORAGE_BUCKET_NAME = 'BUCKET_NAME'
AWS_QUERYSTRING_AUTH = False

from storages.backends.s3 import S3Storage
DOCUMENTS_STORAGE_BACKEND=S3Storage

DEFAULT_FILE_STORAGE = 'storages.backends.s3.S3Storage'

Thanks in advance.


Solution

  • With a test install under virtualenv I was able to get storage to S3 working by adding the following to venv/lib/python2.7/site-packages/mayan/settings/local.py

    INSTALLED_APPS += ('storages',)
    DOCUMENTS_STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage'
    AWS_ACCESS_KEY_ID = 'xxx'
    AWS_SECRET_ACCESS_KEY = 'xxxxxxxx'
    AWS_STORAGE_BUCKET_NAME =  'my-bucket-name'
    AWS_S3_SIGNATURE_VERSION =  's3v4'
    

    (I needed the AWS_S3_SIGNATURE_VERSION to use AWS4-HMAC-SHA256 authentication required at newer AWS regions like Frankfurt.)