Show More
@@ -3,7 +3,9 b'' | |||||
3 | import os |
|
3 | import os | |
4 | # Packagers: modify this line if you store the notebook static files elsewhere |
|
4 | # Packagers: modify this line if you store the notebook static files elsewhere | |
5 | DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static") |
|
5 | DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static") | |
|
6 | # Packagers: modify this line if you store the notebook template files elsewhere | |||
|
7 | DEFAULT_TEMPLATE_FILES_PATH = os.path.join(os.path.dirname(__file__), "templates") | |||
6 |
|
8 | |||
7 | del os |
|
9 | del os | |
8 |
|
10 | |||
9 | from .nbextensions import install_nbextension No newline at end of file |
|
11 | from .nbextensions import install_nbextension |
@@ -51,7 +51,10 b' from tornado import httpserver' | |||||
51 | from tornado import web |
|
51 | from tornado import web | |
52 | from tornado.log import LogFormatter, app_log, access_log, gen_log |
|
52 | from tornado.log import LogFormatter, app_log, access_log, gen_log | |
53 |
|
53 | |||
54 |
from IPython.html import |
|
54 | from IPython.html import ( | |
|
55 | DEFAULT_STATIC_FILES_PATH, | |||
|
56 | DEFAULT_TEMPLATE_FILES_PATH, | |||
|
57 | ) | |||
55 | from .base.handlers import Template404 |
|
58 | from .base.handlers import Template404 | |
56 | from .log import log_request |
|
59 | from .log import log_request | |
57 | from .services.kernels.kernelmanager import MappingKernelManager |
|
60 | from .services.kernels.kernelmanager import MappingKernelManager | |
@@ -138,7 +141,10 b' class NotebookWebApplication(web.Application):' | |||||
138 | log, base_url, default_url, settings_overrides, |
|
141 | log, base_url, default_url, settings_overrides, | |
139 | jinja_env_options=None): |
|
142 | jinja_env_options=None): | |
140 |
|
143 | |||
141 | _template_path = settings_overrides.get("template_path", os.path.join(os.path.dirname(__file__), "templates")) |
|
144 | _template_path = settings_overrides.get( | |
|
145 | "template_path", | |||
|
146 | ipython_app.template_file_path, | |||
|
147 | ) | |||
142 | if isinstance(_template_path, str): |
|
148 | if isinstance(_template_path, str): | |
143 | _template_path = (_template_path,) |
|
149 | _template_path = (_template_path,) | |
144 | template_path = [os.path.expanduser(path) for path in _template_path] |
|
150 | template_path = [os.path.expanduser(path) for path in _template_path] | |
@@ -519,7 +525,20 b' class NotebookApp(BaseIPythonApplication):' | |||||
519 | def static_file_path(self): |
|
525 | def static_file_path(self): | |
520 | """return extra paths + the default location""" |
|
526 | """return extra paths + the default location""" | |
521 | return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH] |
|
527 | return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH] | |
522 |
|
528 | |||
|
529 | extra_template_paths = List(Unicode, config=True, | |||
|
530 | help="""Extra paths to search for serving jinja templates. | |||
|
531 | ||||
|
532 | Can be used to override templates from IPython.html.templates.""" | |||
|
533 | ) | |||
|
534 | def _extra_template_paths_default(self): | |||
|
535 | return [] | |||
|
536 | ||||
|
537 | @property | |||
|
538 | def template_file_path(self): | |||
|
539 | """return extra paths + the default location""" | |||
|
540 | return self.extra_template_paths + [DEFAULT_TEMPLATE_FILES_PATH] | |||
|
541 | ||||
523 | nbextensions_path = List(Unicode, config=True, |
|
542 | nbextensions_path = List(Unicode, config=True, | |
524 | help="""paths for Javascript extensions. By default, this is just IPYTHONDIR/nbextensions""" |
|
543 | help="""paths for Javascript extensions. By default, this is just IPYTHONDIR/nbextensions""" | |
525 | ) |
|
544 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now