chore: Ajout d'un mode test au lancement du serveur pour ajouter des

datas de test
This commit is contained in:
N3WT DE COMPET
2025-02-12 17:44:28 +01:00
parent 0c5e3aa098
commit d3f1ae3d11
4 changed files with 177 additions and 3 deletions

View File

@ -10,6 +10,8 @@ def run_command(command):
print(f"stderr: {stderr.decode()}")
return process.returncode
test_mode = os.getenv('TEST_MODE', 'False') == 'True'
commands = [
["python", "manage.py", "collectstatic", "--noinput"],
["python", "manage.py", "flush", "--noinput"],
@ -20,14 +22,23 @@ commands = [
["python", "manage.py", "makemigrations", "School", "--noinput"],
["python", "manage.py", "migrate", "--noinput"],
["python", "manage.py", "init_payment_plans"],
["python", "manage.py", "init_payment_modes"],
["python", "manage.py", "init_data"]
["python", "manage.py", "init_payment_modes"]
]
test_commands = [
["python", "manage.py", "init_school_configuration"],
["python", "manage.py", "init_school_fees"]
]
for command in commands:
if run_command(command) != 0:
exit(1)
if test_mode:
for test_command in test_commands:
if run_command(test_command) != 0:
exit(1)
# Lancer les processus en parallèle
processes = [
subprocess.Popen(["python", "manage.py", "runserver", "0.0.0.0:8080"]),