From b9a76bc57a27bf2d9e7a8ca39712a9c465e50637 Mon Sep 17 00:00:00 2001 From: ddunne6 Date: Fri, 12 May 2023 22:02:51 +0100 Subject: [PATCH] fix infra configruation --- django_euro_vote/custom_azure.py | 1 - django_euro_vote/settings.py | 14 ++++---------- requirements.txt | 4 +++- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/django_euro_vote/custom_azure.py b/django_euro_vote/custom_azure.py index 0b01c86..872c4c5 100644 --- a/django_euro_vote/custom_azure.py +++ b/django_euro_vote/custom_azure.py @@ -1,4 +1,3 @@ - from storages.backends.azure_storage import AzureStorage from .settings import AZURE_BLOB_KEY, AZURE_ACCOUNT_NAME diff --git a/django_euro_vote/settings.py b/django_euro_vote/settings.py index bd74479..cf33861 100644 --- a/django_euro_vote/settings.py +++ b/django_euro_vote/settings.py @@ -88,8 +88,6 @@ WSGI_APPLICATION = 'django_euro_vote.wsgi.application' -# Database -# https://docs.djangoproject.com/en/3.2/ref/settings/#databases if DEVELOPMENT_MODE: DATABASES = { @@ -111,9 +109,6 @@ } -# Password validation -# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators - AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', @@ -155,9 +150,6 @@ MEDIA_ROOT = f"{BASE_DIR}/media/" MEDIA_URL = '/media/' else: - DEFAULT_FILE_STORAGE = 'django_euro_vote.custom_azure.AzureMediaStorage' - STATICFILES_STORAGE = 'django_euro_vote.custom_azure.AzureStaticStorage' - STATIC_LOCATION = "static" MEDIA_LOCATION = "media" @@ -167,7 +159,9 @@ MEDIA_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{MEDIA_LOCATION}/' AZURE_BLOB_KEY = env('AZ_BLOB_KEY') -# Default primary key field type -# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + STORAGES = { + "default": {"BACKEND": "django_euro_vote.custom_azure.AzureMediaStorage"}, + "staticfiles": {"BACKEND": "django_euro_vote.custom_azure.AzureStaticStorage"}, + } DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/requirements.txt b/requirements.txt index 4dcded0..0a6f750 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,6 @@ django-environ==0.10.0 django_countries==7.5.1 django-crispy-forms==2.0 django-import-export==3.2.0 -crispy-bootstrap5==0.7 \ No newline at end of file +crispy-bootstrap5==0.7 +django-storages[azure] +mysqlclient==2.1.1 \ No newline at end of file