Changeset 9544
- Timestamp:
- Aug 23, 2011, 10:11:58 AM (13 years ago)
- Location:
- src/django_gheat
- Files:
-
- 1 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/settings.py
r9395 r9544 3 3 import os 4 4 PROJECT_HOME = os.path.abspath(os.path.dirname(__file__)) 5 6 DJANGO_PREFIX = '/d' 7 DJANGO_BALANCERS = OSM_PROXY_BALANCERS = ['a','b','c','d','e','f'] 8 OSM_PROXY_CDN_DOMAINS = [d + '.osmproxy.wirelessleiden.nl' for d in DJANGO_BALANCERS] 9 DJANGO_CDN_DOMAINS = [d + '.maps.wirelessleiden.nl' for d in DJANGO_BALANCERS] 5 10 6 11 DEBUG = os.path.exists(PROJECT_HOME + '/enable-debug') … … 65 70 # trailing slash if there is a path component (optional in other cases). 66 71 # Examples: "http://media.lawrence.com", "http://example.com/media/" 67 MEDIA_URL = '/media/'72 MEDIA_URL = DJANGO_PREFIX + '/media/' 68 73 69 74 # Absolute path to the directory static files should be collected to. … … 73 78 STATIC_ROOT = os.path.join(PROJECT_HOME,'sitestatic') 74 79 80 75 81 # URL prefix for static files. 76 82 # Example: "http://media.lawrence.com/static/" 77 STATIC_URL = '/static/'83 STATIC_URL = DJANGO_PREFIX + '/static/' 78 84 79 85 # URL prefix for admin static files -- CSS, JavaScript and images. -
src/django_gheat/wlheatmap/__init__.py
r9139 r9544 1 from django.shortcuts import render_to_response 2 from django.conf import settings 3 4 def js_layer_base(request): 5 return render_to_response('js/LayerBase.js', {'settings' : settings }, 6 mimetype='application/javascript') -
src/django_gheat/wlheatmap/templates/home.html
r9407 r9544 5 5 <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-1.6.2.min.js"></script> 6 6 <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenLayers.js"></script> 7 <script type="text/javascript" language="Javascript" src="{ { STATIC_URL }}OpenStreetMap.js"></script>7 <script type="text/javascript" language="Javascript" src="{% url wlheatmap.js_layer_base %}"></script> 8 8 <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script> 9 9 <script type="text/javascript" language="javascript" src="{{ STATIC_URL }}jquery.chained.js"></script> -
src/django_gheat/wlheatmap/templates/js/LayerBase.js
r9543 r9544 29 29 }; 30 30 31 var wl_balancers = ['a','b','c','d','e','f'];32 31 function get_balanced_urls(prefix, balancers, suffix) { 33 32 var urls = []; 34 for ( i=0; i < balancers.length; i++) {33 for (var i=0; i < balancers.length; i++) { 35 34 urls.push(prefix + balancers[i] + suffix); 36 35 }; … … 39 38 40 39 40 41 41 /** 42 42 * Class: OpenLayers.Layer.OSM.Mapnik … … 54 54 */ 55 55 initialize: function(name, options) { 56 var url = get_balanced_urls('http://', wl_balancers, '.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png');56 var url = get_balanced_urls('http://', {{ settings.OSM_PROXY_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/osm-proxy/${z}/${x},${y}.png'); 57 57 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options); 58 58 var newArguments = [name, url, options]; … … 168 168 OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, { 169 169 initialize: function(name, options) { 170 var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90');170 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90'); 171 171 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 172 172 var newArguments = [name, url, options]; … … 182 182 OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, { 183 183 initialize: function(name, options) { 184 var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden');184 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden'); 185 185 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 186 186 var newArguments = [name, url, options]; … … 196 196 OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, { 197 197 initialize: function(name, options) { 198 var url = get_balanced_urls('http://', wl_balancers, '.maps.wirelessleiden.nl/wlheatmap/tile/${z}/${x},${y}.png?colour=50,150,50&signaal__gte=0&signaal__lte=100');198 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=50,150,50&signaal__gte=0&signaal__lte=100'); 199 199 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 200 200 var newArguments = [name, url, options]; -
src/django_gheat/wlheatmap/urls.py
r9390 r9544 13 13 urlpatterns = patterns('wlheatmap', 14 14 url(r'^$', direct_to_template, {'template' : 'home.html'}), 15 url(r'^js/LayerBase.js$', 'js_layer_base'), 15 16 url(r'^tile/(?P<zoom>\d+)/(?P<x>\d+),(?P<y>\d+).png$', 'tile.serve_tile'), 16 17 url(r'^nodelist/(?P<zoom>\d+),(?P<lat>[0-9.]+),(?P<lon>[0-9.]+)$', 'nodelist.serve_nodelist'),
Note:
See TracChangeset
for help on using the changeset viewer.