updated localhost to "0.0.0.0"
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ except Exception as e:
|
|
23 |
|
24 |
def is_port_in_use(port: int) -> bool:
|
25 |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
26 |
-
return s.connect_ex(("
|
27 |
|
28 |
|
29 |
def find_free_port(starting_port: int) -> int:
|
@@ -42,7 +42,7 @@ def runcode(code: str) -> tuple:
|
|
42 |
|
43 |
try:
|
44 |
process = subprocess.Popen(
|
45 |
-
["streamlit", "run", "code.py", "--server.port", str(free_port)],
|
46 |
stdout=subprocess.PIPE,
|
47 |
stderr=subprocess.PIPE,
|
48 |
text=True,
|
@@ -53,7 +53,7 @@ def runcode(code: str) -> tuple:
|
|
53 |
if process.poll() is None:
|
54 |
return (
|
55 |
free_port,
|
56 |
-
f"Streamlit process started successfully on port {free_port}",
|
57 |
)
|
58 |
else:
|
59 |
stdout, stderr = process.communicate()
|
|
|
23 |
|
24 |
def is_port_in_use(port: int) -> bool:
|
25 |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
26 |
+
return s.connect_ex(("0.0.0.0", port)) == 0
|
27 |
|
28 |
|
29 |
def find_free_port(starting_port: int) -> int:
|
|
|
42 |
|
43 |
try:
|
44 |
process = subprocess.Popen(
|
45 |
+
["streamlit", "run", "code.py", "--server.address", "0.0.0.0","--server.port", str(free_port)],
|
46 |
stdout=subprocess.PIPE,
|
47 |
stderr=subprocess.PIPE,
|
48 |
text=True,
|
|
|
53 |
if process.poll() is None:
|
54 |
return (
|
55 |
free_port,
|
56 |
+
f"Streamlit process started successfully on port {free_port} on Server Address 0.0.0.0 ",
|
57 |
)
|
58 |
else:
|
59 |
stdout, stderr = process.communicate()
|