@@ -171,6 +171,7 @@ def init_settings(self, ipython_app, kernel_manager, contents_manager,
171
171
default_url = default_url ,
172
172
template_path = template_path ,
173
173
static_path = ipython_app .static_file_path ,
174
+ static_custom_path = ipython_app .static_custom_path ,
174
175
static_handler_class = FileFindHandler ,
175
176
static_url_prefix = url_path_join (base_url ,'/static/' ),
176
177
static_handler_args = {
@@ -235,6 +236,12 @@ def init_handlers(self, settings):
235
236
'no_cache_paths' : ['/' ], # don't cache anything in nbextensions
236
237
}),
237
238
)
239
+ handlers .append (
240
+ (r"/custom/(.*)" , FileFindHandler , {
241
+ 'path' : settings ['static_custom_path' ],
242
+ 'no_cache_paths' : ['/' ], # don't cache anything in custom
243
+ })
244
+ )
238
245
# register base handlers last
239
246
handlers .extend (load_handlers ('base.handlers' ))
240
247
# set the URL that will be redirected from `/`
@@ -563,25 +570,29 @@ def _base_project_url_changed(self, name, old, new):
563
570
This allows adding javascript/css to be available from the notebook server machine,
564
571
or overriding individual files in the IPython"""
565
572
)
566
- def _extra_static_paths_default (self ):
567
- return [
568
- # FIXME: remove IPython static path once migration is set up
569
- # and JUPYTER_CONFIG_DIR/custom is served at static/custom
570
- os .path .join (get_ipython_dir (), 'static' ),
571
- ]
572
573
573
574
@property
574
575
def static_file_path (self ):
575
576
"""return extra paths + the default location"""
576
577
return self .extra_static_paths + [DEFAULT_STATIC_FILES_PATH ]
578
+
579
+ static_custom_path = List (Unicode ,
580
+ help = """Path to search for custom.js, css"""
581
+ )
582
+ def _static_custom_path_default (self ):
583
+ return [
584
+ os .path .join (d , 'custom' ) for d in (
585
+ self .config_dir ,
586
+ # FIXME: serve IPython profile while we don't have `jupyter migrate`
587
+ os .path .join (get_ipython_dir (), 'profile_default' , 'static' ),
588
+ DEFAULT_STATIC_FILES_PATH )
589
+ ]
577
590
578
591
extra_template_paths = List (Unicode , config = True ,
579
592
help = """Extra paths to search for serving jinja templates.
580
593
581
594
Can be used to override templates from jupyter_notebook.templates."""
582
595
)
583
- def _extra_template_paths_default (self ):
584
- return []
585
596
586
597
@property
587
598
def template_file_path (self ):
0 commit comments