Skip to content

Commit

Permalink
Add healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyunar committed Jan 27, 2025
1 parent a93045e commit 8f2f1b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion data410/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
"tailwind",
"django_prose_editor",
"adminsortable2",
# Health Check
"health_check",
"health_check.db",
"health_check.cache",
"health_check.storage",
"health_check.contrib.migrations",
"health_check.contrib.s3boto3_storage",
"health_check.contrib.redis",
# XXX: Django Cleanup should be last
"django_cleanup.apps.CleanupConfig",
]
Expand Down Expand Up @@ -127,10 +135,12 @@
db_from_env = dj_database_url.config()
DATABASES["default"].update(db_from_env)

REDIS_URL = os.environ.get("REDIS_URL", "redis://redis:6379/1")

CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": os.environ.get("REDIS_URL", default="redis://redis:6379/1"),
"LOCATION": REDIS_URL,
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
Expand Down
3 changes: 3 additions & 0 deletions data410/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.sitemaps.views import sitemap
from django.urls import path, include
from health_check.views import MainView

from core.sitemaps import sitemaps
from core.views import NotFoundView, ServerErrorView, RobotsView
Expand All @@ -32,6 +34,7 @@
path("registry/", include("registry.urls")),
path("", include("core.urls")),
path("api/", include("api.urls")),
path("ht/", staff_member_required(MainView.as_view()), name="health_check"),
path(
"sitemap.xml",
sitemap,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Django==5.1.4
django-admin-sortable2==2.2.4
django-browser-reload==1.17.0
django-cleanup==9.0.0
django-health-check==3.18.3
django-js-asset==3.0.1
django-prose-editor==0.10.2
django-redis==5.4.0
Expand Down

0 comments on commit 8f2f1b6

Please sign in to comment.