Geek7 commited on
Commit
4f6f053
·
verified ·
1 Parent(s): 5a0eb94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -2,7 +2,8 @@ import os
2
  import subprocess
3
 
4
  if __name__ == "__main__":
5
-
6
-
7
- # Run the Flask app using Gunicorn
8
- os.system("gunicorn -w 4 -b 0.0.0.0:7860 myapp:myapp") # 4 worker processes
 
 
2
  import subprocess
3
 
4
  if __name__ == "__main__":
5
+ try:
6
+ # Run the Flask app using Gunicorn with 4 worker processes
7
+ subprocess.run(["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "myapp:myapp"], check=True)
8
+ except subprocess.CalledProcessError as e:
9
+ print(f"An error occurred while running the application: {e}")