Browse Source

move management directory

master
marax 3 years ago
parent
commit
59f8f6878a
3 changed files with 0 additions and 30 deletions
  1. +0
    -0
      project1/management/__init.py__
  2. +0
    -0
      project1/management/commands/__init.py__
  3. +0
    -30
      project1/management/commands/wait_for_db.py

+ 0
- 0
project1/management/__init.py__ View File


+ 0
- 0
project1/management/commands/__init.py__ View File


+ 0
- 30
project1/management/commands/wait_for_db.py View File

@ -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 !!'))

Loading…
Cancel
Save

Powered by TurnKey Linux.