Skip to content

Commit 5a81946

Browse files
committed
Testing Env
1 parent 5204241 commit 5a81946

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

app.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,41 @@
66
# Function to run the FastAPI app
77
def run_fastapi():
88
try:
9-
# Assuming the FastAPI app is in app.py
9+
# Check if uvicorn is available in the environment
1010
print("Starting FastAPI server...")
11-
subprocess.run(["uvicorn", "src.chatbot.main:app", "--host", "0.0.0.0", "--port", "8000"])
11+
process = subprocess.Popen(
12+
["uvicorn", "src.chatbot.main:app", "--host", "0.0.0.0", "--port", "8000"],
13+
stdout=subprocess.PIPE,
14+
stderr=subprocess.PIPE,
15+
universal_newlines=True
16+
)
17+
18+
# Stream FastAPI output to the terminal
19+
for stdout_line in iter(process.stdout.readline, ""):
20+
print(stdout_line, end="")
21+
22+
# Check if FastAPI process has completed
23+
process.stdout.close()
24+
process.wait()
25+
1226
except Exception as e:
1327
print(f"Error running FastAPI: {e}")
1428

15-
# Function to update and run the React app
29+
# Function to run the React app
1630
def run_react():
1731
try:
1832
# Set working directory to the frontend React folder
33+
print("Starting React app...")
1934
os.chdir('frontend-react')
2035

21-
# Install dependencies if needed
22-
print("Installing npm dependencies...")
36+
# Install dependencies if needed (can be skipped if already installed)
2337
subprocess.run(["npm", "install"])
2438

25-
# Fix vulnerabilities and update deprecated options
26-
print("Fixing vulnerabilities and updating dependencies...")
27-
#subprocess.run(["npm", "audit", "fix"])
28-
#subprocess.run(["npm", "audit", "fix", "--force"])
29-
30-
# Start the React app using npm start
31-
print("Starting React app...")
39+
# Run the React app using npm start
3240
subprocess.run(["npm", "start"])
41+
3342
except Exception as e:
3443
print(f"Error running React app: {e}")
35-
finally:
36-
# Return to the original directory
37-
os.chdir('..')
3844

3945
# Main function to run both FastAPI and React concurrently
4046
def main():

frontend-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
"postcss": "^8.4.47",
4646
"tailwindcss": "^3.4.13"
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)