Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert back azure blob dependencies #2421

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ WORKDIR $HOME
COPY pyproject.toml poetry.lock $HOME/

# Upgrade pip and install python packages for code
RUN pip install --upgrade --no-cache-dir pip poetry \
RUN pip install --upgrade --no-cache-dir pip "poetry>=2.1,<2.2" \
&& poetry --version \
# Configure to use system instead of virtualenvs
&& poetry config virtualenvs.create false \
Expand Down
27 changes: 15 additions & 12 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import environ
import pytz
from azure.identity import DefaultAzureCredential

# from azure.identity import DefaultAzureCredential
from corsheaders.defaults import default_headers
from django.utils.translation import gettext_lazy as _
from urllib3.util.retry import Retry
Expand Down Expand Up @@ -470,6 +471,7 @@ def parse_domain(*env_keys: str) -> str:

if env("AZURE_STORAGE_ENABLED"):

STATIC_ROOT = env("DJANGO_STATIC_ROOT")
AZURE_STORAGE_CONFIG_OPTIONS = {
"connection_string": env("AZURE_STORAGE_CONNECTION_STRING"),
"overwrite_files": False,
Expand All @@ -484,8 +486,8 @@ def parse_domain(*env_keys: str) -> str:
}
)

if env("AZURE_STORAGE_MANAGED_IDENTITY"):
AZURE_STORAGE_CONFIG_OPTIONS["token_credential"] = DefaultAzureCredential()
# if env("AZURE_STORAGE_MANAGED_IDENTITY"):
# AZURE_STORAGE_CONFIG_OPTIONS["token_credential"] = DefaultAzureCredential()

STORAGES = {
"default": {
Expand All @@ -495,15 +497,16 @@ def parse_domain(*env_keys: str) -> str:
"azure_container": "api",
},
},
# FIXME: Use this instead of nginx for staticfiles
# "staticfiles": {
# "BACKEND": "storages.backends.azure_storage.AzureStorage",
# "OPTIONS": {
# **AZURE_STORAGE_CONFIG_OPTIONS,
# "azure_container": env("AZURE_STORAGE_STATIC_CONTAINER"),
# "overwrite_files": True,
# },
# },
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
# FIXME: Use this instead of nginx for staticfiles
# "BACKEND": "storages.backends.azure_storage.AzureStorage",
# "OPTIONS": {
# **AZURE_STORAGE_CONFIG_OPTIONS,
# "azure_container": env("AZURE_STORAGE_STATIC_CONTAINER"),
# "overwrite_files": True,
# },
},
}

# NOTE: This is used for instances outside azure environment
Expand Down
Loading
Loading