plotly / plotly/dash

url_base_pathname default value is None

Open
#2,118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Describe your context

The default value for dash.Dash instance attribute url_base_pathname is None instead of / as indicated in the documentation. When deployed on localhost:8050 there are no issues, however when deployed in a different environment (e.g. behind and ingress gateways) things break. url_base_pathname or the env var DASH_URL_BASE_PATHNAME should be actively set to /.

Installed versions:

dash                 2.5.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table           5.0.0

Describe the bug

According to the documentation, the default value for url_base_pathname should be /, however it is None. In the class definition of dash.Dash, we see that the default is url_base_pathname=None.

from dash import Dash

app = Dash(name="foo")

app.config["url_base_pathname"] is None
# True

Expected behavior

The default value for url_base_pathname should default to /.

Screenshots

The behaviour is confirmed in the console of a running app, line 20, "url_base_pathname": null.

Screenshot 2022-07-05 at 13 32 18

Other comments

In the documentation it is stated that Both requests_pathname_prefix and routes_pathname_prefix default to url_base_pathname, however these two are correctly defaulting to /, even though in app.Dash they are set to requests_pathname_prefix=None and routes_pathname_prefix=None respectively.

Continuing the code snippet above

app.config["routes_pathname_prefix"]
# '/'

app.config["requests_pathname_prefix"]
# '/'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dash class definition and reproduce the issue's Dash(name="foo") configuration snippet. Compare the documented default for url_base_pathname with the observed config values and verify the related prefix defaults. Done means the default behavior and documentation agree, with regression coverage if the repository provides a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.