Spaces:
Sleeping
Sleeping
Unsupported argument 'ssl_mode'
Browse files
app.py
CHANGED
|
@@ -11,7 +11,8 @@ DB_CONFIG = {
|
|
| 11 |
"port": 12374,
|
| 12 |
"user": "avnadmin",
|
| 13 |
"password": "AVNS_rccbF_so2YPvPk3zg0z",
|
| 14 |
-
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
def get_db_connection(database=None):
|
|
@@ -46,22 +47,39 @@ def index():
|
|
| 46 |
# Перевіряємо наявність бази даних employees
|
| 47 |
employees_exists = "employees" in databases
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
return render_template('index.html',
|
| 50 |
status=status,
|
| 51 |
databases=databases,
|
| 52 |
tables=[],
|
| 53 |
employees_exists=employees_exists,
|
| 54 |
remote_connection=True,
|
| 55 |
-
connection_info=
|
| 56 |
except Exception as e:
|
| 57 |
print(f"Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
return render_template('index.html',
|
| 59 |
status={"status": "offline", "error": str(e)},
|
| 60 |
databases=[],
|
| 61 |
tables=[],
|
| 62 |
employees_exists=False,
|
| 63 |
remote_connection=True,
|
| 64 |
-
connection_info=
|
| 65 |
|
| 66 |
@app.route('/database/<database>')
|
| 67 |
def show_database(database):
|
|
@@ -194,7 +212,14 @@ def employees_info():
|
|
| 194 |
|
| 195 |
# Отримуємо інформацію про таблиці
|
| 196 |
cursor.execute("SHOW TABLES FROM employees")
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
tables_info = []
|
| 200 |
for table in tables:
|
|
|
|
| 11 |
"port": 12374,
|
| 12 |
"user": "avnadmin",
|
| 13 |
"password": "AVNS_rccbF_so2YPvPk3zg0z",
|
| 14 |
+
# Використовуємо SSL налаштування замість ssl_mode
|
| 15 |
+
"ssl_ca": False # Використовуємо False, щоб вимкнути перевірку SSL сертифіката
|
| 16 |
}
|
| 17 |
|
| 18 |
def get_db_connection(database=None):
|
|
|
|
| 47 |
# Перевіряємо наявність бази даних employees
|
| 48 |
employees_exists = "employees" in databases
|
| 49 |
|
| 50 |
+
connection_info = {
|
| 51 |
+
"host": DB_CONFIG["host"],
|
| 52 |
+
"port": DB_CONFIG["port"],
|
| 53 |
+
"user": DB_CONFIG["user"],
|
| 54 |
+
"password": DB_CONFIG["password"],
|
| 55 |
+
"ssl_mode": "REQUIRED"
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
return render_template('index.html',
|
| 59 |
status=status,
|
| 60 |
databases=databases,
|
| 61 |
tables=[],
|
| 62 |
employees_exists=employees_exists,
|
| 63 |
remote_connection=True,
|
| 64 |
+
connection_info=connection_info)
|
| 65 |
except Exception as e:
|
| 66 |
print(f"Error: {e}")
|
| 67 |
+
|
| 68 |
+
connection_info = {
|
| 69 |
+
"host": DB_CONFIG["host"],
|
| 70 |
+
"port": DB_CONFIG["port"],
|
| 71 |
+
"user": DB_CONFIG["user"],
|
| 72 |
+
"password": DB_CONFIG["password"],
|
| 73 |
+
"ssl_mode": "REQUIRED"
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
return render_template('index.html',
|
| 77 |
status={"status": "offline", "error": str(e)},
|
| 78 |
databases=[],
|
| 79 |
tables=[],
|
| 80 |
employees_exists=False,
|
| 81 |
remote_connection=True,
|
| 82 |
+
connection_info=connection_info)
|
| 83 |
|
| 84 |
@app.route('/database/<database>')
|
| 85 |
def show_database(database):
|
|
|
|
| 212 |
|
| 213 |
# Отримуємо інформацію про таблиці
|
| 214 |
cursor.execute("SHOW TABLES FROM employees")
|
| 215 |
+
tables_result = cursor.fetchall()
|
| 216 |
+
tables = []
|
| 217 |
+
|
| 218 |
+
# Знаходимо ім'я стовпця з назвою таблиці
|
| 219 |
+
table_column_name = list(tables_result[0].keys())[0] if tables_result else None
|
| 220 |
+
|
| 221 |
+
if table_column_name:
|
| 222 |
+
tables = [table[table_column_name] for table in tables_result]
|
| 223 |
|
| 224 |
tables_info = []
|
| 225 |
for table in tables:
|