2016-12-26 71 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認證。)