2016-12-26 81 views
2

我根据罗伯托罗萨里奥的第二条消息在此链接(https://groups.google.com/forum/#!topic/mayan-edms/tZjmn5u4y2A)设置与s3的玛雅edms,但我现在有一些错误。玛雅edms与s3

尽管我在production.py中添加了s3存储桶设置,但存储/后端/的s3.py无法加载设置。

以下是错误。


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' 

而且在production.py的设置是这样的。


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' 

在此先感谢。

回答

2

与测试下的virtualenv我能得到存储到S3通过添加以下到VENV工作安装/ lib目录/ python2.7 /站点包/玛雅/设置/ 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' 

(我需要AWS_S3_SIGNATURE_VERSION在法兰克福等较新的AWS地区使用AWS4-HMAC-SHA256认证。)