Show More
@@ -89,7 +89,7 b' ipython notebook --port=5555 --ip=* # Listen on port 5555, all interfaces' | |||||
89 |
|
89 | |||
90 | class NotebookWebApplication(web.Application): |
|
90 | class NotebookWebApplication(web.Application): | |
91 |
|
91 | |||
92 | def __init__(self, ipython_app, kernel_manager, notebook_manager, log): |
|
92 | def __init__(self, ipython_app, kernel_manager, notebook_manager, log, settings_overrides): | |
93 | handlers = [ |
|
93 | handlers = [ | |
94 | (r"/", ProjectDashboardHandler), |
|
94 | (r"/", ProjectDashboardHandler), | |
95 | (r"/login", LoginHandler), |
|
95 | (r"/login", LoginHandler), | |
@@ -111,7 +111,11 b' class NotebookWebApplication(web.Application):' | |||||
111 | cookie_secret=os.urandom(1024), |
|
111 | cookie_secret=os.urandom(1024), | |
112 | login_url="/login", |
|
112 | login_url="/login", | |
113 | ) |
|
113 | ) | |
114 | web.Application.__init__(self, handlers, **settings) |
|
114 | ||
|
115 | # allow custom overrides for the tornado web app. | |||
|
116 | settings.update(settings_overrides) | |||
|
117 | ||||
|
118 | super(NotebookWebApplication, self).__init__(handlers, **settings) | |||
115 |
|
119 | |||
116 | self.kernel_manager = kernel_manager |
|
120 | self.kernel_manager = kernel_manager | |
117 | self.log = log |
|
121 | self.log = log | |
@@ -243,6 +247,10 b' class NotebookApp(BaseIPythonApplication):' | |||||
243 | help="Whether to prevent editing/execution of notebooks." |
|
247 | help="Whether to prevent editing/execution of notebooks." | |
244 | ) |
|
248 | ) | |
245 |
|
249 | |||
|
250 | webapp_settings = Dict(config=True, | |||
|
251 | help="Supply overrides for the tornado.web.Application that the " | |||
|
252 | "IPython notebook uses.") | |||
|
253 | ||||
246 | enable_mathjax = Bool(True, config=True, |
|
254 | enable_mathjax = Bool(True, config=True, | |
247 | help="""Whether to enable MathJax for typesetting math/TeX |
|
255 | help="""Whether to enable MathJax for typesetting math/TeX | |
248 |
|
256 | |||
@@ -264,7 +272,7 b' class NotebookApp(BaseIPythonApplication):' | |||||
264 | def _mathjax_url_default(self): |
|
272 | def _mathjax_url_default(self): | |
265 | if not self.enable_mathjax: |
|
273 | if not self.enable_mathjax: | |
266 | return u'' |
|
274 | return u'' | |
267 | static_path = os.path.join(os.path.dirname(__file__), "static") |
|
275 | static_path = self.webapp_settings.get("static_path", os.path.join(os.path.dirname(__file__), "static")) | |
268 | if os.path.exists(os.path.join(static_path, 'mathjax', "MathJax.js")): |
|
276 | if os.path.exists(os.path.join(static_path, 'mathjax', "MathJax.js")): | |
269 | self.log.info("Using local MathJax") |
|
277 | self.log.info("Using local MathJax") | |
270 | return u"static/mathjax/MathJax.js" |
|
278 | return u"static/mathjax/MathJax.js" | |
@@ -315,7 +323,8 b' class NotebookApp(BaseIPythonApplication):' | |||||
315 | super(NotebookApp, self).initialize(argv) |
|
323 | super(NotebookApp, self).initialize(argv) | |
316 | self.init_configurables() |
|
324 | self.init_configurables() | |
317 | self.web_app = NotebookWebApplication( |
|
325 | self.web_app = NotebookWebApplication( | |
318 | self, self.kernel_manager, self.notebook_manager, self.log |
|
326 | self, self.kernel_manager, self.notebook_manager, self.log, | |
|
327 | self.webapp_settings | |||
319 | ) |
|
328 | ) | |
320 | if self.certfile: |
|
329 | if self.certfile: | |
321 | ssl_options = dict(certfile=self.certfile) |
|
330 | ssl_options = dict(certfile=self.certfile) |
General Comments 0
You need to be logged in to leave comments.
Login now