oedb-backend/test_db_connection.py
2025-09-15 23:54:04 +02:00

24 lines
No EOL
694 B
Python
Executable file

#!/usr/bin/env python3
"""
Test script to verify database connection.
This script attempts to connect to the PostgreSQL database using the same
connection logic as the main application.
"""
import sys
from oedb.utils.db import check_db_connection
from oedb.utils.logging import logger
def main():
"""Test database connection and print the result."""
logger.info("Testing database connection...")
if check_db_connection():
logger.success("Database connection successful!")
return 0
else:
logger.error("Database connection failed. Check your .env file and PostgreSQL configuration.")
return 1
if __name__ == "__main__":
sys.exit(main())