Add Flask server startup scripts: introduce start_server.bat for Windows and start-flask-server.py for enhanced server management. Update run.py to include logging and threaded request handling. Add test_server.py for server accessibility testing.

This commit is contained in:
2025-04-25 17:09:09 +01:00
parent 9f8eba6736
commit 73501e7cda
4 changed files with 161 additions and 2 deletions

25
test_server.py Normal file
View File

@@ -0,0 +1,25 @@
import requests
import time
def test_flask_server():
"""Test if the Flask server is accessible at http://127.0.0.1:5000"""
url = "http://127.0.0.1:5000"
print(f"Testing connection to Flask server at {url}")
for i in range(3):
try:
response = requests.get(url, timeout=5)
print(f"SUCCESS! Status code: {response.status_code}")
return True
except requests.exceptions.RequestException as e:
print(f"Attempt {i+1} failed: {e}")
if i < 2:
print("Waiting 2 seconds and trying again...")
time.sleep(2)
print("Failed to connect to the Flask server after 3 attempts")
return False
if __name__ == "__main__":
test_flask_server()