Show More
@@ -874,25 +874,6 b' class FileFindHandler(web.StaticFileHandler):' | |||||
874 | return None |
|
874 | return None | |
875 |
|
875 | |||
876 |
|
876 | |||
877 | # make_static_url and parse_url_path totally unchanged from tornado 2.2.0 |
|
|||
878 | # but needed for tornado < 2.2.0 compat |
|
|||
879 | @classmethod |
|
|||
880 | def make_static_url(cls, settings, path): |
|
|||
881 | """Constructs a versioned url for the given path. |
|
|||
882 |
|
||||
883 | This method may be overridden in subclasses (but note that it is |
|
|||
884 | a class method rather than an instance method). |
|
|||
885 |
|
||||
886 | ``settings`` is the `Application.settings` dictionary. ``path`` |
|
|||
887 | is the static path being requested. The url returned should be |
|
|||
888 | relative to the current host. |
|
|||
889 | """ |
|
|||
890 | static_url_prefix = settings.get('static_url_prefix', '/static/') |
|
|||
891 | version_hash = cls.get_version(settings, path) |
|
|||
892 | if version_hash: |
|
|||
893 | return static_url_prefix + path + "?v=" + version_hash |
|
|||
894 | return static_url_prefix + path |
|
|||
895 |
|
||||
896 | def parse_url_path(self, url_path): |
|
877 | def parse_url_path(self, url_path): | |
897 | """Converts a static URL path into a filesystem path. |
|
878 | """Converts a static URL path into a filesystem path. | |
898 |
|
879 |
@@ -164,8 +164,9 b' class NotebookWebApplication(web.Application):' | |||||
164 | template_path=os.path.join(os.path.dirname(__file__), "templates"), |
|
164 | template_path=os.path.join(os.path.dirname(__file__), "templates"), | |
165 | static_path=ipython_app.static_file_path, |
|
165 | static_path=ipython_app.static_file_path, | |
166 | static_handler_class = FileFindHandler, |
|
166 | static_handler_class = FileFindHandler, | |
|
167 | static_url_prefix = url_path_join(base_project_url,'/static/'), | |||
167 | cookie_secret=os.urandom(1024), |
|
168 | cookie_secret=os.urandom(1024), | |
168 |
login_url= |
|
169 | login_url=url_path_join(base_project_url,'/login'), | |
169 | cookie_name='username-%s' % uuid.uuid4(), |
|
170 | cookie_name='username-%s' % uuid.uuid4(), | |
170 | ) |
|
171 | ) | |
171 |
|
172 | |||
@@ -363,13 +364,33 b' class NotebookApp(BaseIPythonApplication):' | |||||
363 | self.mathjax_url = u'' |
|
364 | self.mathjax_url = u'' | |
364 |
|
365 | |||
365 | base_project_url = Unicode('/', config=True, |
|
366 | base_project_url = Unicode('/', config=True, | |
366 |
help='''The base URL for the notebook server |
|
367 | help='''The base URL for the notebook server. | |
|
368 | ||||
|
369 | Leading and trailing slashes can be omitted, | |||
|
370 | and will automatically be added. | |||
|
371 | ''') | |||
|
372 | def _base_project_url_changed(self, name, old, new): | |||
|
373 | if not new.startswith('/'): | |||
|
374 | self.base_project_url = '/'+new | |||
|
375 | elif not new.endswith('/'): | |||
|
376 | self.base_project_url = new+'/' | |||
|
377 | ||||
367 | base_kernel_url = Unicode('/', config=True, |
|
378 | base_kernel_url = Unicode('/', config=True, | |
368 |
help='''The base URL for the kernel server |
|
379 | help='''The base URL for the kernel server | |
|
380 | ||||
|
381 | Leading and trailing slashes can be omitted, | |||
|
382 | and will automatically be added. | |||
|
383 | ''') | |||
|
384 | def _base_kernel_url_changed(self, name, old, new): | |||
|
385 | if not new.startswith('/'): | |||
|
386 | self.base_kernel_url = '/'+new | |||
|
387 | elif not new.endswith('/'): | |||
|
388 | self.base_kernel_url = new+'/' | |||
|
389 | ||||
369 | websocket_host = Unicode("", config=True, |
|
390 | websocket_host = Unicode("", config=True, | |
370 | help="""The hostname for the websocket server.""" |
|
391 | help="""The hostname for the websocket server.""" | |
371 | ) |
|
392 | ) | |
372 |
|
393 | |||
373 | extra_static_paths = List(Unicode, config=True, |
|
394 | extra_static_paths = List(Unicode, config=True, | |
374 | help="""Extra paths to search for serving static files. |
|
395 | help="""Extra paths to search for serving static files. | |
375 |
|
396 |
@@ -2,7 +2,7 b'' | |||||
2 |
|
2 | |||
3 | <!DOCTYPE HTML> |
|
3 | <!DOCTYPE HTML> | |
4 | {% macro static_url(name) -%} |
|
4 | {% macro static_url(name) -%} | |
5 |
|
|
5 | {{ base_project_url }}static/{{ name }} | |
6 | {%- endmacro %} |
|
6 | {%- endmacro %} | |
7 | <html> |
|
7 | <html> | |
8 |
|
8 | |||
@@ -28,7 +28,7 b'' | |||||
28 | <body {% block params %}{% endblock %}> |
|
28 | <body {% block params %}{% endblock %}> | |
29 |
|
29 | |||
30 | <div id="header"> |
|
30 | <div id="header"> | |
31 | <span id="ipython_notebook"><div><a href={{base_project_url}} alt='dashboard'><img src='{{static_url("ipynblogo.png") }}' alt='IPython Notebook'/></a></div></span> |
|
31 | <span id="ipython_notebook"><div><a href="{{base_project_url}}" alt='dashboard'><img src='{{static_url("ipynblogo.png") }}' alt='IPython Notebook'/></a></div></span> | |
32 |
|
32 | |||
33 | {% block login_widget %} |
|
33 | {% block login_widget %} | |
34 |
|
34 |
General Comments 0
You need to be logged in to leave comments.
Login now