Skip to content
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
19 changes: 11 additions & 8 deletions chris_backend/config/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"""
Django settings for chris_backend project.

Generated by 'django-admin startproject' using Django 4.2.5.
Generated by 'django-admin startproject' using Django 5.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
https://docs.djangoproject.com/en/5.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path
Expand Down Expand Up @@ -114,17 +114,20 @@


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'pool': True # use defaults
}
}
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -143,7 +146,7 @@


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -155,7 +158,7 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = '/static/'

Expand All @@ -170,7 +173,7 @@
STATIC_ROOT = '/opt/app-root/var/staticfiles'

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Expand Down
10 changes: 5 additions & 5 deletions chris_backend/config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from django.core.exceptions import ImproperlyConfigured

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'w1kxu^l=@pnsf!5piqz6!!5kdcdpo79y6jebbp+2244yjm*#+k'
Expand All @@ -28,14 +28,14 @@
CHRIS_SUPERUSER_PASSWORD = 'chris1234'

# Hosts/domain names that are valid for this site
# See https://docs.djangoproject.com/en/4.2/ref/settings/#allowed-hosts
# See https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

# LOGGING CONFIGURATION
# See https://docs.djangoproject.com/en/4.2/topics/logging/ for
# See https://docs.djangoproject.com/en/5.1/topics/logging/ for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
Expand Down Expand Up @@ -105,7 +105,7 @@

try:
verify_storage_connection(
DEFAULT_FILE_STORAGE=STORAGES['default']['BACKEND'],
STORAGES=STORAGES,
MEDIA_ROOT=MEDIA_ROOT,
SWIFT_CONTAINER_NAME=SWIFT_CONTAINER_NAME,
SWIFT_CONNECTION_PARAMS=SWIFT_CONNECTION_PARAMS
Expand All @@ -117,7 +117,7 @@
CHRIS_STORE_URL = 'http://chris-store.local:8010/api/v1/'

# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
DATABASES['default']['NAME'] = 'chris_dev'
DATABASES['default']['USER'] = 'chris'
DATABASES['default']['PASSWORD'] = 'Chris1234'
Expand Down
10 changes: 5 additions & 5 deletions chris_backend/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_secret(setting, secret_type=env):

# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/4.2/ref/settings/#secret-key
# See: https://docs.djangoproject.com/en/5.1/ref/settings/#secret-key
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = get_secret('DJANGO_SECRET_KEY')

Expand All @@ -42,7 +42,7 @@ def get_secret(setting, secret_type=env):
# SITE CONFIGURATION
# ------------------------------------------------------------------------------
# Hosts/domain names that are valid for this site
# See https://docs.djangoproject.com/en/4.2/ref/settings/#allowed-hosts
# See https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts
ALLOWED_HOSTS = get_secret('DJANGO_ALLOWED_HOSTS', env.list)
# END SITE CONFIGURATION

Expand Down Expand Up @@ -72,14 +72,14 @@ def get_secret(setting, secret_type=env):
'key': SWIFT_KEY,
'authurl': SWIFT_AUTH_URL}
verify_storage = lambda: verify_storage_connection(
DEFAULT_FILE_STORAGE=STORAGES['default']['BACKEND'],
STORAGES=STORAGES,
SWIFT_CONTAINER_NAME=SWIFT_CONTAINER_NAME,
SWIFT_CONNECTION_PARAMS=SWIFT_CONNECTION_PARAMS
)
elif STORAGE_ENV in ('fslink', 'filesystem'):
STORAGES['default'] = {'BACKEND': 'django.core.files.storage.FileSystemStorage'}
MEDIA_ROOT = get_secret('MEDIA_ROOT')
verify_storage = lambda: verify_storage_connection(DEFAULT_FILE_STORAGE=STORAGES['default']['BACKEND'],
verify_storage = lambda: verify_storage_connection(STORAGES=STORAGES,
MEDIA_ROOT=MEDIA_ROOT)
else:
verify_storage = lambda: verify_storage_connection()
Expand All @@ -95,7 +95,7 @@ def get_secret(setting, secret_type=env):


# LOGGING CONFIGURATION
# See https://docs.djangoproject.com/en/4.2/topics/logging/ for
# See https://docs.djangoproject.com/en/5.1/topics/logging/ for
# more details on how to customize your logging configuration.
ADMINS = [('FNNDSC Developers', '[email protected]')]
LOGGING = {
Expand Down
6 changes: 4 additions & 2 deletions chris_backend/core/storage/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def mock_storage(target_settings) -> ContextManager[FilesystemManager]:
"""
with TemporaryDirectory() as tmp_dir:
settings = {
'DEFAULT_FILE_STORAGE': 'fake.FileSystemStorage',
'STORAGES': {
'default': {'BACKEND': 'fake.FileSystemStorage'}
},
'MEDIA_ROOT': tmp_dir
}
with unittest.mock.patch.multiple(target_settings, **settings):
Expand All @@ -61,4 +63,4 @@ def __init__(self, settings_dict: Dict[str, str]):


def __get_storage_name(settings: Any) -> str:
return settings.DEFAULT_FILE_STORAGE.rsplit('.', maxsplit=1)[-1]
return settings.STORAGES['default']['BACKEND'].rsplit('.', maxsplit=1)[-1]
2 changes: 2 additions & 0 deletions chris_backend/plugins/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ def test_add_plugins_from_file_view(self):
'available_apps': ANY,
'is_popup': ANY,
'is_nav_sidebar_enabled': ANY,
'log_entries': ANY,
'opts': ANY,
'file_form': ANY})

Expand All @@ -393,6 +394,7 @@ def test_add_plugins_from_file_view(self):
'available_apps': ANY,
'is_popup': ANY,
'is_nav_sidebar_enabled': ANY,
'log_entries': ANY,
'opts': ANY,
'summary': summary})

Expand Down
6 changes: 3 additions & 3 deletions docker-compose_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ services:
role: "Backend development periodic tasks scheduler"

chris_dev_db:
image: postgres:16
image: postgres:17
volumes:
- chris_dev_db_data:/var/lib/postgresql/data
environment:
Expand All @@ -202,7 +202,7 @@ services:
start_period: 60s

queue:
image: rabbitmq:3
image: rabbitmq:4
hostname: 'queue'
volumes:
- queue_data:/var/lib/rabbitmq
Expand Down Expand Up @@ -246,7 +246,7 @@ services:
role: "Chris store service"

chris_store_db:
image: postgres:16
image: postgres:17
volumes:
- chris_store_db_data:/var/lib/postgresql/data
environment:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose_just.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ services:
- local

db:
image: docker.io/library/postgres:16
image: docker.io/library/postgres:17
volumes:
- db:/var/lib/postgresql/data
environment:
Expand All @@ -113,7 +113,7 @@ services:
- chris_dev_db # hard-coded in chris_backend/config/settings/local.py

rabbitmq:
image: docker.io/library/rabbitmq:3
image: docker.io/library/rabbitmq:4
volumes:
- rabbitmq:/var/lib/rabbitmq
networks:
Expand Down
7 changes: 3 additions & 4 deletions docker-compose_noswift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# 1. Run rm docker-compose_dev.yml && ln -sv docker-compose_noswift.yml docker-compose_dev.yml
# 2. Edit chris_backend/config/settings/local.py, include the configs
#
# DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
# MEDIA_ROOT = '/data'
#
# 3. Run ./make.sh -s -i
Expand Down Expand Up @@ -185,7 +184,7 @@ services:
role: "Backend development periodic tasks scheduler"

chris_dev_db:
image: postgres:16
image: postgres:17
volumes:
- chris_dev_db_data:/var/lib/postgresql/data
environment:
Expand All @@ -205,7 +204,7 @@ services:
start_period: 60s

queue:
image: rabbitmq:3
image: rabbitmq:4
hostname: 'queue'
volumes:
- queue_data:/var/lib/rabbitmq
Expand Down Expand Up @@ -244,7 +243,7 @@ services:
role: "Chris store service"

chris_store_db:
image: postgres:16
image: postgres:17
volumes:
- chris_store_db_data:/var/lib/postgresql/data
environment:
Expand Down
26 changes: 13 additions & 13 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Django==4.2.5
django-filter==23.3
djangorestframework==3.14.0
django-cors-headers==4.2.0
Django==5.1.7
django-filter==25.1
djangorestframework==3.15.2
django-cors-headers==4.7.0
psycopg[binary,pool]
environs==9.5.0
python-swiftclient==4.4.0
django-storage-swift==1.3.0
celery==5.3.4
django-celery-beat==2.5.0
environs==14.1.1
python-swiftclient==4.7.0
django-storage-swift==1.4.0
celery==5.4.0
django-celery-beat==2.7.0
python-chrisstoreclient==1.0.0
python-pfconclient==3.2.0
django-auth-ldap==4.5.0
PyYAML==6.0.1
django-auth-ldap==5.1.0
PyYAML==6.0.2
whitenoise[brotli]==6.5.0
PyJWT===2.8.0
channels==4.1.0
PyJWT===2.10.1
channels==4.2.0
nats-py==2.9.0
granian==1.6.1
git+https://github.com/tfranzel/drf-spectacular.git@refs/pull/1307/head
12 changes: 6 additions & 6 deletions requirements/local.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Local development dependencies go here
-r base.txt
django-debug-toolbar==4.2.0
django-debug-toolbar==5.0.1
django-extensions==3.2.3
collection-json==0.1.1
coverage==7.3.1
pylint==2.17.5
flake8==6.1.0
isort==5.12.0
pudb==2022.1.3
coverage==7.6.12
pylint==3.3.4
flake8==7.1.2
isort==6.0.1
pudb==2024.1.3
daphne==4.1.2 # required by (django) channels.testing
granian[reload]
https://github.com/msbrogli/rpudb/archive/master.zip
Loading