mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
chore: Ajout d'un mode test au lancement du serveur pour ajouter des
datas de test
This commit is contained in:
@ -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"]),
|
||||
|
||||
Reference in New Issue
Block a user