Skip to content

Commit 4920e33

Browse files
committed
fixing run command to trigger devtools properly
1 parent 1088331 commit 4920e33

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dash/server_factories/fastapi_factory.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313

1414
class FastAPIServerFactory(BaseServerFactory):
15+
def __init__(self):
16+
self.config = {}
17+
super().__init__()
18+
1519
def __call__(self, server, *args, **kwargs):
1620
# ASGI: (scope, receive, send)
1721
if len(args) == 3 and isinstance(args[0], dict) and "type" in args[0]:
@@ -71,6 +75,7 @@ async def index(request: Request):
7175
def setup_catchall(self, app, dash_app):
7276
@dash_app.server.on_event("startup")
7377
def _setup_catchall():
78+
dash_app.enable_dev_tools(**self.config) # do this to make sure dev tools are enabled
7479
from fastapi import Request, Response
7580

7681
async def catchall(path: str, request: Request):
@@ -111,6 +116,9 @@ def run(self, app, host, port, debug, **kwargs):
111116
frame = inspect.stack()[2]
112117
import uvicorn
113118

119+
self.config = dict({'debug': debug} if debug else {}, **kwargs)
120+
121+
114122
reload = debug
115123
if reload:
116124
# Dynamically determine the module name from the file path

0 commit comments

Comments
 (0)