Skip to content

Commit 70be538

Browse files
authored
Merge pull request #466 from facultyai/docs-dev-mode
Serve dash-bootstrap-components locally in development mode
2 parents 34532c2 + 1abe2fb commit 70be538

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

docs/components_page/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from pathlib import Path
23

34
import dash
@@ -9,6 +10,8 @@
910
from .components.tabs.simple import tab1_content, tab2_content
1011
from .markdown_parser import parse
1112

13+
SERVE_LOCALLY = os.getenv("DBC_DOCS_MODE", "production") == "dev"
14+
1215
HERE = Path(__file__).parent
1316
COMPONENTS = HERE / "components"
1417
TEMPLATES = HERE.parent / "templates"
@@ -130,7 +133,7 @@ def register_apps():
130133
external_stylesheets=["/static/loading.css"],
131134
requests_pathname_prefix=f"/docs/components/{slug}/",
132135
suppress_callback_exceptions=True,
133-
serve_locally=False,
136+
serve_locally=SERVE_LOCALLY,
134137
index_string=template.render(
135138
sidenav_items=sidenav_items,
136139
sidenav_active="components",

docs/examples/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from .vendor.graphs_in_tabs import app as git_app
1010
from .vendor.iris import app as iris_app
1111

12+
SERVE_LOCALLY = os.getenv("DBC_DOCS_MODE", "production") == "dev"
13+
1214
HREF_PATTERN = re.compile(r'href="')
1315

1416
HERE = Path(__file__).parent
@@ -73,7 +75,7 @@ def build_app_from_example(app, name, code, code_link, show_warning=False):
7375
new_app = dash.Dash(
7476
external_stylesheets=["/static/loading.css", dbc.themes.BOOTSTRAP],
7577
requests_pathname_prefix=f"/examples/{name}/",
76-
serve_locally=False,
78+
serve_locally=SERVE_LOCALLY,
7779
index_string=template.replace("<CODE>", code),
7880
update_title=None,
7981
)

docs/run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
)
1717

1818
if __name__ == "__main__":
19+
import os
20+
1921
from werkzeug.serving import run_simple
2022

23+
os.environ["DBC_DOCS_MODE"] = "dev"
2124
run_simple("localhost", 8888, application, use_reloader=True)

0 commit comments

Comments
 (0)