Skip to content

Commit 168aa23

Browse files
Merge pull request #197 from DrDroidLab/feat/introduces-django-5
introduces django 5.2
2 parents 68dbf9b + 952ea4c commit 168aa23

File tree

6 files changed

+34
-16
lines changed

6 files changed

+34
-16
lines changed

agent/apps.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import logging
2+
import os
3+
import sys
24

35
import requests
46
from django.apps import AppConfig
@@ -8,6 +10,18 @@
810

911
logger = logging.getLogger(__name__)
1012

13+
_MANAGEMENT_CMDS_SKIP_DRD_PING = frozenset(
14+
{'check', 'test', 'makemigrations', 'migrate', 'showmigrations'}
15+
)
16+
17+
18+
def _skip_drd_cloud_startup_ping() -> bool:
19+
if os.environ.get('SKIP_DRD_CLOUD_STARTUP_PING', '').lower() in ('1', 'true', 'yes'):
20+
return True
21+
if len(sys.argv) >= 2 and sys.argv[1] in _MANAGEMENT_CMDS_SKIP_DRD_PING:
22+
return True
23+
return False
24+
1125

1226
class AgentConfig(AppConfig):
1327
default_auto_field = 'django.db.models.BigAutoField'
@@ -28,7 +42,11 @@ def ready(self):
2842
if settings.NATIVE_KUBERNETES_API_MODE:
2943
logger.info('Native Kubernetes API mode is enabled')
3044

31-
# Establish reachability with DRD Cloud
45+
# Establish reachability with DRD Cloud (skipped for check/test/migrate etc.)
46+
if _skip_drd_cloud_startup_ping():
47+
logger.info('Skipping DRD Cloud startup ping for this management command')
48+
return
49+
3250
response = requests.get(f'{drd_cloud_host}/connectors/proxy/ping',
3351
headers={'Authorization': f'Bearer {drd_cloud_api_token}'},
3452
params={'commit_hash': commit_hash})

agent/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the ASGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
7+
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
88
"""
99

1010
import os

agent/settings.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
22
Django settings for agent project.
33
4-
Generated by 'django-admin startproject' using Django 4.2.16.
4+
Generated by 'django-admin startproject' using Django 4.2.16; upgraded to Django 5.2 LTS.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/topics/settings/
7+
https://docs.djangoproject.com/en/5.2/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/4.2/ref/settings/
10+
https://docs.djangoproject.com/en/5.2/ref/settings/
1111
"""
1212

1313
import os
@@ -36,7 +36,7 @@ def load_yaml(filepath, native_k8s_connector_mode=False):
3636

3737

3838
# Quick-start development settings - unsuitable for production
39-
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
39+
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
4040

4141
# SECURITY WARNING: keep the secret key used in production secret!
4242
SECRET_KEY = env.str("DJANGO_SECRET_KEY", default='django-insecure-3-9*i+n@+)07+$lde6v%+705m+jz9_v9r6##qizm+0&x%)963g')
@@ -102,7 +102,7 @@ def load_yaml(filepath, native_k8s_connector_mode=False):
102102
WSGI_APPLICATION = 'agent.wsgi.application'
103103

104104
# Database
105-
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
105+
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
106106

107107
DATABASES = {
108108
'default': {
@@ -205,7 +205,7 @@ def load_yaml(filepath, native_k8s_connector_mode=False):
205205
REDIS_URL = env.str('REDIS_URL', default='redis://localhost:6379')
206206

207207
# Password validation
208-
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
208+
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
209209

210210
AUTH_PASSWORD_VALIDATORS = [
211211
{
@@ -223,7 +223,7 @@ def load_yaml(filepath, native_k8s_connector_mode=False):
223223
]
224224

225225
# Internationalization
226-
# https://docs.djangoproject.com/en/4.2/topics/i18n/
226+
# https://docs.djangoproject.com/en/5.2/topics/i18n/
227227

228228
LANGUAGE_CODE = 'en-us'
229229

@@ -234,13 +234,13 @@ def load_yaml(filepath, native_k8s_connector_mode=False):
234234
USE_TZ = True
235235

236236
# Static files (CSS, JavaScript, Images)
237-
# https://docs.djangoproject.com/en/4.1/howto/static-files/
237+
# https://docs.djangoproject.com/en/5.2/howto/static-files/
238238

239239
STATIC_URL = 'static/'
240240
STATIC_ROOT = os.path.join(BASE_DIR, "static")
241241

242242
# Default primary key field type
243-
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
243+
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
244244

245245
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
246246

agent/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
URL configuration for agent project.
33
44
The `urlpatterns` list routes URLs to views. For more information please see:
5-
https://docs.djangoproject.com/en/4.2/topics/http/urls/
5+
https://docs.djangoproject.com/en/5.2/topics/http/urls/
66
Examples:
77
Function views
88
1. Add an import: from my_app import views

agent/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
88
"""
99

1010
import os

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ distro==1.9.0
3737
dj-database-url==1.2.0
3838
dj-email-url==1.0.6
3939
dj-rest-auth==2.2.7
40-
Django>=4.2.14,<5
40+
Django>=5.2,<5.3
4141
django-allauth>=65.14.1
4242
django-appconf==1.0.5
4343
django-cache-url==3.4.4
@@ -100,7 +100,7 @@ oauthlib==3.2.2
100100
openai==1.35.15
101101
opsgenie-sdk==2.1.5
102102
packaging==24.1
103-
pandas==2.3.1
103+
pandas>=2.3.3,<2.4
104104
paramiko==3.4.1
105105
pdpyras==5.2.0
106106
portalocker==2.10.1
@@ -150,4 +150,4 @@ websocket-client==1.8.0
150150
yarl==1.12.1
151151
zstandard==0.23.0
152152
# Latest version of drdroid-debug-toolkit -> added logql cleanup
153-
git+https://github.com/DrDroidLab/drdroid-debug-toolkit.git@master
153+
git+https://github.com/DrDroidLab/drdroid-debug-toolkit.git@feat/django-5-introduced

0 commit comments

Comments
 (0)