Co-authored-by: Jai <jai@voicegain.ai> Co-authored-by: Horilla <131998600+horilla-opensource@users.noreply.github.com>
24 lines
500 B
Python
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()
|