Skip to content

Commit

Permalink
fix: default to localhost on WSL (#180)
Browse files Browse the repository at this point in the history
* fix: Only reload necessary files & default to localhost on WSL

* fix: default WSL into localhost URL

* fix: remove uname

* revert: reload

* fix: replace variable with branching

* Update __main__.py

* fix: remove debug code

Co-authored-by: Maarten Breddels <[email protected]>

---------

Co-authored-by: Maarten Breddels <[email protected]>
  • Loading branch information
Lundez and maartenbreddels committed Jul 4, 2023
1 parent 30b3e33 commit d483b87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions solara/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def open_browser():

if open:
threading.Thread(target=open_browser, daemon=True).start()

rich.print(f"Solara server is starting at {url}")

if log_level is not None:
Expand Down
5 changes: 4 additions & 1 deletion solara/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import uuid
from enum import Enum
from pathlib import Path
import re
from typing import Optional

import pydantic
Expand Down Expand Up @@ -120,7 +121,9 @@ class Config:


HOST_DEFAULT = os.environ.get("HOST", "localhost")
if "arm64-apple-darwin" in HOST_DEFAULT: # conda activate script
is_mac_os_conda = "arm64-apple-darwin" in HOST_DEFAULT
is_wsl_windows = re.match(r".*?-w1[0-9]", HOST_DEFAULT)
if is_mac_os_conda or is_wsl_windows:
HOST_DEFAULT = "localhost"


Expand Down

0 comments on commit d483b87

Please sign in to comment.