-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
43 lines (36 loc) · 1.38 KB
/
Copy pathrun.py
File metadata and controls
43 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import subprocess
if __name__ == "__main__":
print("Apakah Anda ingin melakukan migrasi database? (Y/N)")
migration_confirmation = input().strip().upper()
if migration_confirmation == 'Y':
print("'Y' untuk migration Fresh dan 'N' untuk Migration Normal. (Y/N)")
migration_mode = input().strip().upper()
if migration_mode == 'Y':
print("Running database migration...")
subprocess.run(["python", "migration.py", "--fresh"])
print("Database migration completed.")
elif migration_mode == 'N':
print("Running database migration...")
subprocess.run(["python", "migration.py"])
print("Database migration completed.")
else:
print("Pilihan tidak valid.")
print("Starting API server...")
api_process = subprocess.Popen(["python", "api.py"])
print("Starting Flask routes...")
route_process = subprocess.Popen(["python", "route.py"])
try:
api_process.wait()
except KeyboardInterrupt:
print("Stopping API server...")
api_process.terminate()
api_process.wait()
print("API server stopped.")
try:
route_process.wait()
except KeyboardInterrupt:
print("Stopping Flask routes...")
route_process.terminate()
route_process.wait()
print("Flask routes stopped.")