Files
ihrm/horilla/horilla_backends_gcp.py
2025-02-26 10:53:49 +05:30

24 lines
500 B
Python

"""
horilla/horilla_backends_gcp.py
"""
from django.db import models
from storages.backends.gcloud import GoogleCloudStorage
from horilla import settings
class PrivateMediaStorage(GoogleCloudStorage):
"""
PrivateMediaStorage
"""
location = settings.env("NAMESPACE", default="private")
default_acl = "private"
file_overwrite = False
# To set the private storage globally
models.FileField.storage = PrivateMediaStorage()
models.ImageField.storage = PrivateMediaStorage()