-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
69 lines (50 loc) · 1.58 KB
/
commands.py
File metadata and controls
69 lines (50 loc) · 1.58 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import subprocess
def run_makemigrations():
subprocess.run(
('docker-compose', 'run', 'web', 'python', 'manage.py', 'makemigrations'))
def run_migrate():
subprocess.run(
('docker-compose', 'run', 'web', 'python', 'manage.py', 'migrate'))
def run_createsuperuser():
subprocess.run(
('docker-compose', 'run', 'web', 'python', 'manage.py', 'createsuperuser'))
def run_startapp(app_name: str):
subprocess.run(
('docker-compose', 'run', 'web', 'python', 'manage.py', 'startapp', app_name))
def run_docker_build():
subprocess.run(('docker-compose', 'build'))
def run_docker_up():
subprocess.run(('docker-compose', 'up'))
def run_docker_build_up():
subprocess.run(('docker-compose', 'up', '--build'))
def main():
print("\n")
print("Choose a command to run:")
print("1. Django Makemigrations")
print("2. Django Migrate")
print("3. Django Createsuperuser")
print("4. Django StartApp")
print("5. Docker Build")
print("6. Docker Up")
print("7. Docker Build Then Up")
choice = input("Enter your choice: ")
print("\n")
if choice == "1":
run_makemigrations()
elif choice == "2":
run_migrate()
elif choice == "3":
run_createsuperuser()
elif choice == "4":
app_name = input("Enter app name: ")
run_startapp(app_name)
elif choice == "5":
run_docker_build()
elif choice == "6":
run_docker_up()
elif choice == "7":
run_docker_build_up()
else:
print("Invalid choice. Exiting.")
if __name__ == "__main__":
main()