Autosave: 20260130-045645
This commit is contained in:
parent
7b86c4d661
commit
74aa3572c9
Binary file not shown.
Binary file not shown.
BIN
core/management/commands/__pycache__/wait_for_db.cpython-311.pyc
Normal file
BIN
core/management/commands/__pycache__/wait_for_db.cpython-311.pyc
Normal file
Binary file not shown.
@ -14,7 +14,8 @@ class Command(BaseCommand):
|
|||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# Print the connection details (masked password) for debugging
|
# Print the connection details (masked password) for debugging
|
||||||
db_conf = settings.DATABASES['default']
|
db_conf = settings.DATABASES['default']
|
||||||
self.stdout.write(f"Debug Info - Host: {db_conf.get('HOST')}, Port: {db_conf.get('PORT')}, Name: {db_conf.get('NAME')}, User: {db_conf.get('USER')}")
|
host_val = db_conf.get('HOST')
|
||||||
|
self.stdout.write(f"Debug Info - Host: {host_val}, Port: {db_conf.get('PORT')}, Name: {db_conf.get('NAME')}, User: {db_conf.get('USER')}")
|
||||||
|
|
||||||
# DEBUG: Check which MySQLdb is loaded
|
# DEBUG: Check which MySQLdb is loaded
|
||||||
try:
|
try:
|
||||||
@ -46,6 +47,12 @@ class Command(BaseCommand):
|
|||||||
# Print the full error message
|
# Print the full error message
|
||||||
self.stdout.write(f'Database unavailable (Error: {e}), waiting 1 second...')
|
self.stdout.write(f'Database unavailable (Error: {e}), waiting 1 second...')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
except UnicodeError as e:
|
||||||
|
self.stdout.write(self.style.ERROR(f"CONFIGURATION ERROR: The DB_HOST '{host_val}' is invalid."))
|
||||||
|
self.stdout.write(self.style.ERROR(f"Details: {e}"))
|
||||||
|
self.stdout.write(self.style.ERROR("Hint: Check your 'DB_HOST' variable in Coolify. It seems to be too long or contains invalid characters."))
|
||||||
|
self.stdout.write(self.style.ERROR("Common mistakes: pasting the full connection string (mysql://...) instead of just the hostname, or trailing spaces."))
|
||||||
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.stdout.write(self.style.WARNING(f'Database error: {e}, waiting 1 second...'))
|
self.stdout.write(self.style.WARNING(f'Database error: {e}, waiting 1 second...'))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user