refactor run script with env varsa

This commit is contained in:
ALIHAN DIKEL
2025-03-10 15:34:58 +03:00
parent 7f5af1cb85
commit c5698cb6e0
2 changed files with 23 additions and 3 deletions

23
scripts/run_webapp.py Executable file
View File

@@ -0,0 +1,23 @@
import os
import subprocess
from dotenv import load_dotenv
load_dotenv("env")
# Get variables with defaults
PORT = os.getenv("PORT", "9999")
RELOAD = os.getenv("RELOAD", "True").lower() == "true"
# Build the command
cmd = [
"uvicorn",
"main:app",
"--host 0.0.0.0",
"--port", PORT
]
if RELOAD:
cmd.append("--reload")
subprocess.run(cmd)

View File

@@ -1,3 +0,0 @@
#!/bin/bash
uvicorn main:app --host 0.0.0.0 --port 9999 --reload