Gestion des dossiers sur VPS

This commit is contained in:
2025-10-26 11:28:15 +01:00
parent 9cf31189a9
commit 5f9c8c7472
2 changed files with 23 additions and 0 deletions

17
app/Test_Mysql.py Normal file
View File

@@ -0,0 +1,17 @@
import os, mysql.connector
from dotenv import load_dotenv
from pathlib import Path
# charge le .env **avec chemin absolu**
load_dotenv(Path(__file__).resolve().parent.joinpath(".env"))
conn = mysql.connector.connect(
host=os.getenv("DB_HOST"),
user=os.getenv("DB_USER"),
password=os.getenv("DB_PASSWORD"),
database=os.getenv("DB_NAME"),
connection_timeout=5,
)
conn.ping(reconnect=True, attempts=3, delay=1)
print("CONNECTED" if conn.is_connected() else "KO")
conn.close()

View File

@@ -0,0 +1,6 @@
import bcrypt
password = input("Entre le mot de passe admin à hacher : ")
hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
print("\nHash généré :")
print(hashed.decode())