Changeset 9544


Ignore:
Timestamp:
Aug 23, 2011, 10:11:58 AM (13 years ago)
Author:
rick
Message:

Make the path and CDN domain settings transparent.

Location:
src/django_gheat
Files:
1 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/django_gheat/settings.py

    r9395 r9544  
    33import os
    44PROJECT_HOME = os.path.abspath(os.path.dirname(__file__))
     5
     6DJANGO_PREFIX = '/d'
     7DJANGO_BALANCERS = OSM_PROXY_BALANCERS = ['a','b','c','d','e','f']
     8OSM_PROXY_CDN_DOMAINS = [d + '.osmproxy.wirelessleiden.nl' for d in DJANGO_BALANCERS]
     9DJANGO_CDN_DOMAINS = [d + '.maps.wirelessleiden.nl' for d in DJANGO_BALANCERS]
    510
    611DEBUG = os.path.exists(PROJECT_HOME + '/enable-debug')
     
    6570# trailing slash if there is a path component (optional in other cases).
    6671# Examples: "http://media.lawrence.com", "http://example.com/media/"
    67 MEDIA_URL = '/media/'
     72MEDIA_URL = DJANGO_PREFIX + '/media/'
    6873
    6974# Absolute path to the directory static files should be collected to.
     
    7378STATIC_ROOT =  os.path.join(PROJECT_HOME,'sitestatic')
    7479
     80
    7581# URL prefix for static files.
    7682# Example: "http://media.lawrence.com/static/"
    77 STATIC_URL = '/static/'
     83STATIC_URL = DJANGO_PREFIX + '/static/'
    7884
    7985# URL prefix for admin static files -- CSS, JavaScript and images.
  • src/django_gheat/wlheatmap/__init__.py

    r9139 r9544  
     1from django.shortcuts import render_to_response
     2from django.conf import settings
     3
     4def 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  
    55  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-1.6.2.min.js"></script>
    66  <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>
    88  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
    99  <script type="text/javascript" language="javascript" src="{{ STATIC_URL }}jquery.chained.js"></script>
  • src/django_gheat/wlheatmap/templates/js/LayerBase.js

    r9543 r9544  
    2929};
    3030
    31 var wl_balancers = ['a','b','c','d','e','f'];
    3231function get_balanced_urls(prefix, balancers, suffix) {
    3332  var urls = [];
    34   for (i=0 ; i < balancers.length; i++) {
     33  for (var i=0; i < balancers.length; i++) {
    3534    urls.push(prefix + balancers[i] + suffix);
    3635  };
     
    3938
    4039
     40
    4141/**
    4242 * Class: OpenLayers.Layer.OSM.Mapnik
     
    5454     */
    5555    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');
    5757        options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
    5858        var newArguments = [name, url, options];
     
    168168OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    169169    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');
    171171        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    172172        var newArguments = [name, url, options];
     
    182182OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    183183    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');
    185185        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    186186        var newArguments = [name, url, options];
     
    196196OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
    197197  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');
    199199    options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    200200    var newArguments = [name, url, options];
  • src/django_gheat/wlheatmap/urls.py

    r9390 r9544  
    1313urlpatterns = patterns('wlheatmap',
    1414    url(r'^$', direct_to_template, {'template' : 'home.html'}),
     15    url(r'^js/LayerBase.js$', 'js_layer_base'),
    1516    url(r'^tile/(?P<zoom>\d+)/(?P<x>\d+),(?P<y>\d+).png$', 'tile.serve_tile'),
    1617    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.