wishwakankanamg commited on
Commit
c3edd7f
·
1 Parent(s): fdcebbb
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -15,25 +15,19 @@ from pathlib import Path
15
 
16
  import subprocess
17
 
18
- def run_command(command_list, description):
19
- print(f"Running: {description}")
20
  try:
21
- subprocess.run(command_list, check=True)
22
- except subprocess.CalledProcessError as e:
23
- print(f"Error during: {description}\n{e}")
24
- sys.exit(1)
25
 
26
- def startup():
27
- # Step 1: Update from origin
28
- run_command(["git", "fetch", "origin"], "Git fetch")
29
- run_command(["git", "reset", "--hard", "origin/main"], "Git reset")
30
-
31
- # Step 2: Install Python dependencies
32
- run_command([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], "Pip install requirements")
33
-
34
- # Step 3: Run your app (replace with the correct entry point)
35
- run_command([sys.executable, "app.py"], "Starting the app")
36
 
 
37
 
38
  load_dotenv()
39
 
@@ -859,5 +853,3 @@ if __name__ == "__main__":
859
 
860
 
861
 
862
- if __name__ == "__main__":
863
- startup()
 
15
 
16
  import subprocess
17
 
18
+ def update_repo():
 
19
  try:
20
+ subprocess.run(["git", "fetch", "origin"], check=True)
21
+ subprocess.run(["git", "reset", "--hard", "origin/main"], check=True)
22
+ # Step 2: Install Python dependencies
23
+ subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], "Pip install requirements")
24
 
25
+ # Step 3: Run your app (replace with the correct entry point)
26
+ subprocess.run([sys.executable, "app.py"], "Starting the app")
27
+ except Exception as e:
28
+ print(f"Git update failed: {e}")
 
 
 
 
 
 
29
 
30
+ update_repo()
31
 
32
  load_dotenv()
33
 
 
853
 
854
 
855