diff --git a/notebook/app.py b/notebook/app.py index 9a969b50a..55795b359 100644 --- a/notebook/app.py +++ b/notebook/app.py @@ -354,7 +354,8 @@ class JupyterNotebookApp(NotebookConfigShimMixin, LabServerApp): # type:ignore[ self.handlers.append(("/edit(.*)", FileHandler)) self.handlers.append(("/consoles/(.*)", ConsoleHandler)) self.handlers.append(("/terminals/(.*)", TerminalHandler)) - self.handlers.append(("/custom/custom.css", CustomCssHandler)) + if self.custom_css: + self.handlers.append(("/custom/custom.css", CustomCssHandler)) super().initialize_handlers() def initialize(self, argv: list[str] | None = None) -> None: # noqa: ARG002