Skip to content

Commit

Permalink
django storages setup config
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-work committed Jul 29, 2024
1 parent 999d3ca commit 9b63d57
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
21 changes: 21 additions & 0 deletions daras_ai_v2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"handles",
"payments",
"functions",
"static_pages",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -182,6 +183,7 @@
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
"default": {},
}

# Default primary key field type
Expand Down Expand Up @@ -234,6 +236,25 @@
GOOGLE_CLIENT_ID = config("GOOGLE_CLIENT_ID", default="")
FIREBASE_CONFIG = config("FIREBASE_CONFIG", default="")


# django-storages settings for google-cloud
from google.oauth2 import service_account

GCS_CONFIG = config("GCS_CONFIG", default="")
GCS_PRIVATE_KEY = config("GCS_PRIVATE_KEY", default="")
GCS_CREDENTIALS = service_account.Credentials.from_service_account_info(
info={**json.loads(GCS_CONFIG), "private_key": GCS_PRIVATE_KEY}
)

STORAGES["default"] = {
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
"OPTIONS": {
"project_id": GCP_PROJECT,
"bucket_name": GS_BUCKET_NAME,
"credentials": GCS_CREDENTIALS,
},
}

UBERDUCK_KEY = config("UBERDUCK_KEY", None)
UBERDUCK_SECRET = config("UBERDUCK_SECRET", None)

Expand Down
46 changes: 45 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ azure-cognitiveservices-speech = "^1.37.0"
twilio = "^9.2.3"
sentry-sdk = {version = "1.45.0", extras = ["loguru"]}
gooey-gui = "^0.1.0"
django-storages = "^1.14.4"

[tool.poetry.group.dev.dependencies]
watchdog = "^2.1.9"
Expand Down

0 comments on commit 9b63d57

Please sign in to comment.