mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 00:30:59 +00:00
Fix default storage setting and use new STORAGES (#573)
This commit is contained in:
parent
dcc4a5723e
commit
51ffcc6192
1 changed files with 5 additions and 2 deletions
|
@ -307,6 +307,9 @@ STORAGES = {
|
||||||
"staticfiles": {
|
"staticfiles": {
|
||||||
"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
||||||
},
|
},
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "django.core.files.storage.FileSystemStorage",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
||||||
|
@ -404,14 +407,14 @@ if SETUP.MEDIA_BACKEND:
|
||||||
parsed = urllib.parse.urlparse(SETUP.MEDIA_BACKEND)
|
parsed = urllib.parse.urlparse(SETUP.MEDIA_BACKEND)
|
||||||
query = urllib.parse.parse_qs(parsed.query)
|
query = urllib.parse.parse_qs(parsed.query)
|
||||||
if parsed.scheme == "gs":
|
if parsed.scheme == "gs":
|
||||||
DEFAULT_FILE_STORAGE = "core.uploads.TakaheGoogleCloudStorage"
|
STORAGES["default"]["BACKEND"] = "core.uploads.TakaheGoogleCloudStorage"
|
||||||
GS_BUCKET_NAME = parsed.path.lstrip("/")
|
GS_BUCKET_NAME = parsed.path.lstrip("/")
|
||||||
GS_QUERYSTRING_AUTH = False
|
GS_QUERYSTRING_AUTH = False
|
||||||
if parsed.hostname is not None:
|
if parsed.hostname is not None:
|
||||||
port = parsed.port or 443
|
port = parsed.port or 443
|
||||||
GS_CUSTOM_ENDPOINT = f"https://{parsed.hostname}:{port}"
|
GS_CUSTOM_ENDPOINT = f"https://{parsed.hostname}:{port}"
|
||||||
elif parsed.scheme == "s3":
|
elif parsed.scheme == "s3":
|
||||||
DEFAULT_FILE_STORAGE = "core.uploads.TakaheS3Storage"
|
STORAGES["default"]["BACKEND"] = "core.uploads.TakaheS3Storage"
|
||||||
AWS_STORAGE_BUCKET_NAME = parsed.path.lstrip("/")
|
AWS_STORAGE_BUCKET_NAME = parsed.path.lstrip("/")
|
||||||
AWS_QUERYSTRING_AUTH = False
|
AWS_QUERYSTRING_AUTH = False
|
||||||
AWS_DEFAULT_ACL = SETUP.MEDIA_BACKEND_S3_ACL
|
AWS_DEFAULT_ACL = SETUP.MEDIA_BACKEND_S3_ACL
|
||||||
|
|
Loading…
Reference in a new issue