From a173c129eda4cfb268c03639041573ca1295d978 Mon Sep 17 00:00:00 2001 From: samuel dudley Date: Sat, 30 Sep 2017 18:10:15 +0930 Subject: [PATCH 1/2] apply application prefix to static files in tornado server --- app/cesium_web_server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/cesium_web_server.py b/app/cesium_web_server.py index 6480745..232f5ea 100644 --- a/app/cesium_web_server.py +++ b/app/cesium_web_server.py @@ -75,10 +75,11 @@ def __init__(self, module): handlers.append((r"/"+APP_PREFIX+"websocket/", DefaultWebSocket, cb)) settings = dict( - cookie_secret=APP_SECRET_KEY, - template_path=APP_TEMPLATES, - static_path=APP_STATIC, - xsrf_cookies=False, + cookie_secret = APP_SECRET_KEY, + template_path = APP_TEMPLATES, + static_path = APP_STATIC, + static_url_prefix = "/"+APP_PREFIX+"static/", + xsrf_cookies = False, ) super(Application, self).__init__(handlers, **settings) From 359c97cb781264eaada2aea3c89b1818659bcc33 Mon Sep 17 00:00:00 2001 From: samuel dudley Date: Sun, 1 Oct 2017 00:12:18 +0930 Subject: [PATCH 2/2] support application prefix of static files in javascript --- app/static/DST/js/context_menu.js | 2 +- app/static/DST/js/core.js | 10 +++++----- app/static/DST/js/wp.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/static/DST/js/context_menu.js b/app/static/DST/js/context_menu.js index 51c0c9c..c1e9bcc 100644 --- a/app/static/DST/js/context_menu.js +++ b/app/static/DST/js/context_menu.js @@ -88,7 +88,7 @@ $contextMenu.on("mouseover", "a", function(evt){ if (marker != null){ selected.marker = marker document.getElementsByTagName("body")[0].style.cursor = "pointer" // change the pointer to a hand - selected.marker.image= '/static/DST/wp_icons/ylw-blank.png' + selected.marker.image= '/'+app_prefix+'static/DST/wp_icons/ylw-blank.png' selected.alt_line = get_by_id(alt_lines, selected.marker.id) } else{ diff --git a/app/static/DST/js/core.js b/app/static/DST/js/core.js index b71a270..e583e6b 100644 --- a/app/static/DST/js/core.js +++ b/app/static/DST/js/core.js @@ -7,7 +7,7 @@ $(function () { var vehicle_offset_x = 25 var vehicle_offset_y = 25 var vehicle_offset_z = 25 - var vehicle_model = '/static/DST/models/rat.gltf' + var vehicle_model = '/'+app_prefix+'static/DST/models/rat.gltf' var position = Cesium.Cartesian3.fromDegrees(0, 0, 0); var heading = 0; @@ -420,7 +420,7 @@ $(function () { function clear_selected_marker(){ if (selected.marker != null){ document.getElementsByTagName("body")[0].style.cursor = "default" - selected.marker.image = '/static/DST/wp_icons/blu-blank.png' // re-set the wp icon to be unselected... + selected.marker.image = '/'+app_prefix+'static/DST/wp_icons/blu-blank.png' // re-set the wp icon to be unselected... selected.marker = null selected.alt_line = null } @@ -472,8 +472,8 @@ $(function () { if (selected.marker != null && selected.dragging) { - selected.marker.image= '/static/DST/wp_icons/ylw-blank.png' // make / keep the marker yellow - document.getElementsByTagName("body")[0].style.cursor = "url(/static/DST/pointers/move.png), pointer" + selected.marker.image= '/'+app_prefix+'static/DST/wp_icons/ylw-blank.png' // make / keep the marker yellow + document.getElementsByTagName("body")[0].style.cursor = "url('/'+app_prefix+'static/DST/pointers/move.png), pointer" if (!selected.camera_stored){ store_camera() // store the current camera until after release @@ -544,7 +544,7 @@ $(function () { if (selected.marker != null && !selected.dragging){ // this is the only point where we select the wp // we dont select if we are dragging otherwise we can move wp's accidentally when panning the camera... document.getElementsByTagName("body")[0].style.cursor = "pointer" // change the pointer to a hand - selected.marker.image= '/static/DST/wp_icons/ylw-blank.png' + selected.marker.image= '/'+app_prefix+'static/DST/wp_icons/ylw-blank.png' selected.alt_line = get_by_id(alt_lines, selected.marker.id) // selected.label = get_by_id(labels, selected.marker.id) } else { // we have not picked a wp diff --git a/app/static/DST/js/wp.js b/app/static/DST/js/wp.js index 2865207..21d6d3a 100644 --- a/app/static/DST/js/wp.js +++ b/app/static/DST/js/wp.js @@ -42,7 +42,7 @@ function create_wp(id, wp_data){ markers.add({ id : id, position : Cesium.Cartesian3.fromDegrees(wp_data.y, wp_data.x, wp_data.z+height_offset), - image : '/static/DST/wp_icons/blu-blank.png', + image : '/'+app_prefix+'static/DST/wp_icons/blu-blank.png', verticalOrigin : Cesium.VerticalOrigin.BOTTOM, horizontalOrigin : Cesium.HorizontalOrigin.CENTER });