Skip to content

Commit

Permalink
chore: set up wait_for_db management command scaffold
Browse files Browse the repository at this point in the history
Introduce a skeleton for the 'wait_for_db' management command within the core app. This command will ensure robust deployment processes by preventing the application from starting before the database is ready, thus mitigating race conditions. This commit lays the groundwork for the upcoming implementation that will handle database connectivity checks.
https://docs.djangoproject.com/en/5.0/howto/custom-management-commands/
  • Loading branch information
nkordis committed Apr 29, 2024
1 parent 0060919 commit 69e6a60
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'core',
]

MIDDLEWARE = [
Expand Down
Empty file added app/core/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/core/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions app/core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
Empty file added app/core/management/__init__.py
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions app/core/management/commands/wait_for_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Django command to wait for the database to be available.
"""
from django.core.management.base import BaseCommand

class Command(BaseCommand):
"""Django command to wait for database."""

def handle(self, *args, **options):
pass
Empty file added app/core/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/core/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
Empty file added app/core/tests/__init__.py
Empty file.

0 comments on commit 69e6a60

Please sign in to comment.