First shot in GeoRSS support
This commit is contained in:
parent
46b3868bc4
commit
39f672641c
5 changed files with 27 additions and 2 deletions
1
fabfile.py
vendored
1
fabfile.py
vendored
|
@ -237,6 +237,7 @@ def collect_remote_statics(name=None):
|
|||
'markercluster': 'git://github.com/Leaflet/Leaflet.markercluster.git@master#0.4',
|
||||
'measure': 'git://github.com/makinacorpus/Leaflet.MeasureControl.git@gh-pages',
|
||||
'label': 'git://github.com/Leaflet/Leaflet.label.git@master',
|
||||
'georsstogeojson': 'git://github.com/yohanboniface/GeoRSSToGeoJSON.git@master',
|
||||
}
|
||||
with cd(remote_static_dir):
|
||||
for subdir, path in remote_repositories.iteritems():
|
||||
|
|
|
@ -148,7 +148,8 @@ AUTHENTICATION_BACKENDS += (
|
|||
#==============================================================================
|
||||
LEAFLET_STORAGE_ALLOW_ANONYMOUS = False
|
||||
LEAFLET_STORAGE_EXTRA_URLS = {
|
||||
'routing': 'http://map.project-osrm.org/?loc={lat},{lng}&hl={locale}'
|
||||
'routing': 'http://map.project-osrm.org/?loc={lat},{lng}&hl={locale}',
|
||||
'ajax_proxy': '/ajax-proxy/{url}'
|
||||
}
|
||||
SITE_URL = "http://umap.org"
|
||||
UMAP_DEMO_SITE = False
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
<script src="{{ STATIC_URL }}measure/leaflet.measurecontrol.js"></script>
|
||||
<script src="{{ STATIC_URL }}contextmenu/dist/leaflet.contextmenu-src.js"></script>
|
||||
<script src="{{ STATIC_URL }}label/dist/leaflet.label-src.js"></script>
|
||||
<script src="{{ STATIC_URL }}georsstogeojson/GeoRSSToGeoJSON.js"></script>
|
||||
{% endcompress %}
|
||||
{% if locale %}
|
||||
<script src="{{ STATIC_URL }}storage/src/locale/{{ locale }}.js"></script>
|
||||
{% endif %}
|
||||
{% compress js %}
|
||||
<script src="{{ STATIC_URL }}storage/src/js/leaflet.storage.core.js"></script>
|
||||
<script src="{{ STATIC_URL }}storage/src/js/leaflet.storage.popup.js"></script>
|
||||
<script src="{{ STATIC_URL }}storage/src/js/leaflet.storage.xhr.js"></script>
|
||||
<script src="{{ STATIC_URL }}storage/src/js/leaflet.storage.forms.js"></script>
|
||||
<script src="{{ STATIC_URL }}storage/src/js/leaflet.storage.icon.js"></script>
|
||||
|
|
|
@ -17,6 +17,7 @@ urlpatterns = patterns(
|
|||
(r'^admin/', include(admin.site.urls)),
|
||||
url('', include('social.apps.django_app.urls', namespace='social')),
|
||||
url(r'^m/(?P<pk>\d+)/$', MapShortUrl.as_view(), name='umap_short_url'),
|
||||
url(r'^ajax-proxy/(?P<url>.+)$', cache_page(60)(views.ajax_proxy), name='ajax-proxy'),
|
||||
)
|
||||
urlpatterns += i18n_patterns(
|
||||
'',
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import simplejson
|
||||
import mimetypes
|
||||
import urllib2
|
||||
|
||||
from django.views.generic import TemplateView
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -143,7 +145,7 @@ search = Search.as_view()
|
|||
|
||||
class MapsShowCase(View):
|
||||
|
||||
def get(*args, **kargs):
|
||||
def get(self, *args, **kwargs):
|
||||
maps = Map.public.filter(center__distance_gt=(DEFAULT_CENTER, D(km=1))).order_by('-modified_at')[:2000]
|
||||
|
||||
def make(m):
|
||||
|
@ -173,3 +175,21 @@ class MapsShowCase(View):
|
|||
return HttpResponse(simplejson.dumps(geojson))
|
||||
|
||||
showcase = MapsShowCase.as_view()
|
||||
|
||||
|
||||
class AjaxProxy(View):
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
# You should not use this in production (use Nginx or so)
|
||||
url = kwargs['url']
|
||||
try:
|
||||
proxied_request = urllib2.urlopen(url)
|
||||
status_code = proxied_request.code
|
||||
mimetype = proxied_request.headers.typeheader or mimetypes.guess_type(url)
|
||||
content = proxied_request.read()
|
||||
except urllib2.HTTPError as e:
|
||||
return HttpResponse(e.msg, status=e.code, mimetype='text/plain')
|
||||
else:
|
||||
return HttpResponse(content, status=status_code, mimetype=mimetype)
|
||||
|
||||
ajax_proxy = AjaxProxy.as_view()
|
||||
|
|
Loading…
Reference in a new issue