Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic host #19

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions src_backend_python/tabloo/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def index():
return redirect("index.html")


def serve(df, open_browser, server_port=5000, server_logging=True, debug=False):
def serve(df, open_browser, server_host="127.0.0.1", server_port=5000, server_logging=True, debug=False):
# TODO: We may add some auto port handling like this: https://stackoverflow.com/a/5089963/1804173

url = "http://127.0.0.1:{0}".format(server_port)
url = "http://{0}:{1}".format(server_host, server_port)

global backend
backend = Backend(df)
Expand All @@ -127,6 +127,7 @@ def serve(df, open_browser, server_port=5000, server_logging=True, debug=False):

app.run(
port=server_port,
host=server_host,
debug=debug,
use_reloader=debug,
processes=1,
Expand Down
5 changes: 3 additions & 2 deletions src_backend_python/tabloo/tabloo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
def show(
df,
open_browser=True,
server_host="127.0.0.1",
server_port=5000,
server_logging=False,
debug=False,
):
debug=False):
"""
Runs a Tabloo app on a given dataframe.

Expand All @@ -33,6 +33,7 @@ def show(
server.serve(
df=df,
open_browser=open_browser,
server_host=server_host,
server_port=server_port,
server_logging=server_logging,
debug=debug,
Expand Down
3 changes: 2 additions & 1 deletion src_frontend/store_backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function transformValue(x: any): any {
}

export class StoreBackend implements StoreInterface {
url = "http://localhost:5000";
// TODO: this needs to be dynamic
url = "http://127.0.0.1:5000";

async fetchColumns(): Promise<string[]> {
const response = await axios.get(`${this.url}/api/get_columns`);
Expand Down