mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-09 03:50:45 +08:00
Override mimetype for .css files
This should avoid the issue several people have had with unstyled pages on misconfigured Windows systems. I think practicality beats purity here. Closes gh-1350
This commit is contained in:
parent
db7fa4ab85
commit
cc3a8668f2
@ -12,6 +12,7 @@ import importlib
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
@ -1115,7 +1116,14 @@ class NotebookApp(JupyterApp):
|
||||
raise
|
||||
self.log.warning("Error loading server extension %s", modulename,
|
||||
exc_info=True)
|
||||
|
||||
|
||||
def init_mime_overrides(self):
|
||||
# On some Windows machines, an application has registered an incorrect
|
||||
# mimetype for CSS in the registry. Tornado uses this when serving
|
||||
# .css files, causing browsers to reject the stylesheet. We know the
|
||||
# mimetype always needs to be text/css, so we override it here.
|
||||
mimetypes.add_type('text/css', '.css')
|
||||
|
||||
@catch_config_error
|
||||
def initialize(self, argv=None):
|
||||
super(NotebookApp, self).initialize(argv)
|
||||
@ -1128,6 +1136,7 @@ class NotebookApp(JupyterApp):
|
||||
self.init_terminals()
|
||||
self.init_signal()
|
||||
self.init_server_extensions()
|
||||
self.init_mime_overrides()
|
||||
|
||||
def cleanup_kernels(self):
|
||||
"""Shutdown all kernels.
|
||||
|
Loading…
Reference in New Issue
Block a user