根据Roberto Rosario的第2条消息(https://groups.google.com/forum/#!topic/mayan-edms/tZjmn5u4y2A),我正在设置带有s3的玛雅edms,但我现在遇到了一些错误。
即使我在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'
提前致谢。
答案 0 :(得分:2)
通过virtualenv下的测试安装,我可以通过将以下内容添加到venv / lib / python2.7 / site-packages / mayan / settings / local.py
来获得存储到S3工作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身份验证。)