6. StoragesΒΆ
sendmail supports integration with django-storages. By default FileSystemStorage is used for storing sendmail data.
You can override this behaviour by specifying STORAGES config in settings.py.
For example for configuring MiniIO (compatible with S3 API):
Install django-storages and boto3:
pip install django-storages boto3
To your installed apps add storages
Define your storages:
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"endpoint_url": 'http://138.232.3.68:9000', # Note the lowercase 'endpoint_url'
'access_key': 'minioadmin',
'secret_key': 'minioadmin',
'bucket_name': 'media',
'querystring_auth': False,
'use_ssl': False, # Set this to True if you use HTTPS
'file_overwrite': False, # Optional: set to False to avoid overwriting files with the same name
},
},
'staticfiles': {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"endpoint_url": 'http://138.232.3.68:9000', # Note the lowercase 'endpoint_url'
'access_key': 'minioadmin',
'secret_key': 'minioadmin',
'bucket_name': 'static',
'querystring_auth': False,
'use_ssl': False, # Set this to True if you use HTTPS
'file_overwrite': False, # Optional: set to False to avoid overwriting files with the same name
},
},
'sendmail_attachments': {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"endpoint_url": 'http://138.232.3.68:9000',
'access_key': 'minioadmin',
'secret_key': 'minioadmin',
'bucket_name': 'attachments',
'querystring_auth': True,
'use_ssl': False,
'file_overwrite': False,
}
}
}
defaultstorage is used to storemediafiles. In context ofboto3it should always havequerystring_auth = False. To ensure proper work ofckeditor_uploader.staticfilesstorage is used to store projectstaticfiles. As project depends onckeditorit should always havequerystring_auth = False.sendmail_attachmentsstorage used to store ckeditor attachments. Defaults todefault_storage. Strongly recommended to override it with any private storage.