From 59f8f6878a681e9f5b4ad604a846564ff93dfe22 Mon Sep 17 00:00:00 2001 From: marax Date: Thu, 4 Nov 2021 17:01:01 +0100 Subject: [PATCH] move management directory --- project1/management/__init.py__ | 0 project1/management/commands/__init.py__ | 0 project1/management/commands/wait_for_db.py | 30 --------------------- 3 files changed, 30 deletions(-) delete mode 100644 project1/management/__init.py__ delete mode 100644 project1/management/commands/__init.py__ delete mode 100644 project1/management/commands/wait_for_db.py diff --git a/project1/management/__init.py__ b/project1/management/__init.py__ deleted file mode 100644 index e69de29..0000000 diff --git a/project1/management/commands/__init.py__ b/project1/management/commands/__init.py__ deleted file mode 100644 index e69de29..0000000 diff --git a/project1/management/commands/wait_for_db.py b/project1/management/commands/wait_for_db.py deleted file mode 100644 index f6be870..0000000 --- a/project1/management/commands/wait_for_db.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Django command to wait until DB is started - -""" - -import time - -from psycopg2 import OperationalError as Psycopg2OpError -from django.db.utils import OperationalError - -from django.core.management.base import BaseCommand - -class Command(BaseCommand): - """ Django wait for DB""" - self.stdout.write('Waiting for Database ...') - db_up = False - while db_up is False: - try: - self.check(database=['default']) - db_up = True - except (Psycopg2OpError, OperationalError): - self.stdout.write('Database unavailable, waiting 1 sec...') - time.sleep(1) - - self.stdout.write(self.style.SUCCESS('database ready !!')) - - - - -