[Python] Dash App Only Accessible on 127.0.0.1, Not on 0.0.0.0 or Local Network IP

Discussão em 'Python' iniciado por Stack, Julho 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing a multi-page Dash app using dash.pages and dash-bootstrap-components. I want to make it accessible from other devices on my local network (e.g., via 0.0.0.0:8050 or 10.233.233.158:8050), but it only opens on 127.0.0.1:8050. Accessing the app from other machines or even using the server's IP address in a browser on the same machine does not work. Also, on my Windows server, 0.0.0.0:8050 or 10.233.233.158:8050 is not opening on the browser!

    Here's my app.py:

    import dash
    from dash import html
    import dash_bootstrap_components as dbc
    from utils.b2b_db import init_db

    # Initialize the Dash app with Bootstrap theme
    app = dash.Dash(
    __name__,
    use_pages=True, # Enable multi-page support
    external_stylesheets=[dbc.themes.BOOTSTRAP],
    suppress_callback_exceptions=True
    )

    # Initialize database
    init_db()

    # Create the navigation bar
    navbar = dbc.Navbar(
    dbc.Container([
    dbc.NavbarBrand("ISP Analytics", href="/", className="ms-2"),
    dbc.Nav([
    dbc.NavLink(
    [html.Div(page["name"])],
    href=page["path"],
    active="exact",
    )
    for page in dash.page_registry.values()
    ])
    ]),
    color="dark",
    dark=True,
    className="mb-2"
    )

    # Layout
    app.layout = html.Div([
    navbar,
    dash.page_container
    ])

    if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8050, debug=False)


    I've verified that:

    • My firewall is disabled or allows traffic on port 8050.
    • No errors are raised when I run the app.
      (venv) E:\ISP DASH>python app.py
      Dash is running on http://0.0.0.0:8050/

      Serving Flask app 'app'
      Debug mode: off
      WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
      Running on all addresses (0.0.0.0)
      Running on http://127.0.0.1:8050
      Running on http://10.233.233.158:8050 ```
    • The development server starts, but only 127.0.0.1:8050 works.

    How can I make this app accessible from another machine on the same network using the local IP (like 10.233.233.158:8050)? Any help would be appreciated.

    Thanks!

    Continue reading...

Compartilhe esta Página