##// END OF EJS Templates
add '?v=<date>' to require URLs...
Min RK -
Show More
@@ -130,6 +130,11 class IPythonHandler(AuthenticatedHandler):
130 #---------------------------------------------------------------
130 #---------------------------------------------------------------
131
131
132 @property
132 @property
133 def version_hash(self):
134 """The version hash to use for cache hints for static files"""
135 return self.settings.get('version_hash', '')
136
137 @property
133 def mathjax_url(self):
138 def mathjax_url(self):
134 return self.settings.get('mathjax_url', '')
139 return self.settings.get('mathjax_url', '')
135
140
@@ -240,6 +245,7 class IPythonHandler(AuthenticatedHandler):
240 static_url=self.static_url,
245 static_url=self.static_url,
241 sys_info=sys_info,
246 sys_info=sys_info,
242 contents_js_source=self.contents_js_source,
247 contents_js_source=self.contents_js_source,
248 version_hash=self.version_hash,
243 )
249 )
244
250
245 def get_json_body(self):
251 def get_json_body(self):
@@ -7,6 +7,7
7 from __future__ import print_function
7 from __future__ import print_function
8
8
9 import base64
9 import base64
10 import datetime
10 import errno
11 import errno
11 import io
12 import io
12 import json
13 import json
@@ -84,6 +85,7 from IPython.utils.traitlets import (
84 )
85 )
85 from IPython.utils import py3compat
86 from IPython.utils import py3compat
86 from IPython.utils.path import filefind, get_ipython_dir
87 from IPython.utils.path import filefind, get_ipython_dir
88 from IPython.utils.sysinfo import get_sys_info
87
89
88 from .utils import url_path_join
90 from .utils import url_path_join
89
91
@@ -151,6 +153,15 class NotebookWebApplication(web.Application):
151
153
152 jenv_opt = jinja_env_options if jinja_env_options else {}
154 jenv_opt = jinja_env_options if jinja_env_options else {}
153 env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)
155 env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)
156
157 sys_info = get_sys_info()
158 if sys_info['commit_source'] == 'repository':
159 # don't cache (rely on 304) when working from master
160 version_hash = ''
161 else:
162 # reset the cache on server restart
163 version_hash = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
164
154 settings = dict(
165 settings = dict(
155 # basics
166 # basics
156 log_function=log_request,
167 log_function=log_request,
@@ -160,6 +171,7 class NotebookWebApplication(web.Application):
160 static_path=ipython_app.static_file_path,
171 static_path=ipython_app.static_file_path,
161 static_handler_class = FileFindHandler,
172 static_handler_class = FileFindHandler,
162 static_url_prefix = url_path_join(base_url,'/static/'),
173 static_url_prefix = url_path_join(base_url,'/static/'),
174 version_hash=version_hash,
163
175
164 # authentication
176 # authentication
165 cookie_secret=ipython_app.cookie_secret,
177 cookie_secret=ipython_app.cookie_secret,
@@ -18,6 +18,9
18 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
18 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
19 <script>
19 <script>
20 require.config({
20 require.config({
21 {% if version_hash %}
22 urlArgs: "v={{version_hash}}",
23 {% endif %}
21 baseUrl: '{{static_url("", include_version=False)}}',
24 baseUrl: '{{static_url("", include_version=False)}}',
22 paths: {
25 paths: {
23 nbextensions : '{{ base_url }}nbextensions',
26 nbextensions : '{{ base_url }}nbextensions',
General Comments 0
You need to be logged in to leave comments. Login now