diff --git a/fabfile.py b/fabfile.py index a3b473a0..c83ace52 100644 --- a/fabfile.py +++ b/fabfile.py @@ -166,7 +166,6 @@ def collectstatic(): """ Collect static files from apps and other locations in a single location. """ - collect_remote_statics("storage") dj('collectstatic --link --noinput') dj('storagei18n') dj('compress') @@ -213,57 +212,6 @@ def requirements(name=None, upgrade=False): )) -@task -@roles('web') -def collect_remote_statics(name=None): - """ - Add leaflet and leaflet.draw in a repository watched by collectstatic. - """ - remote_static_dir = '{project_dir}/{project_name}/remote_static'.format(**env) - run_as_umap('mkdir -p {0}'.format(remote_static_dir)) - remote_repositories = { - 'leaflet': "git://github.com/Leaflet/Leaflet.git@master#v0.7.2", - 'draw': "git://github.com/Leaflet/Leaflet.draw.git@master#0.2.3", - 'heat': "git://github.com/Leaflet/Leaflet.heat.git@gh-pages", - 'hash': "git://github.com/mlevans/leaflet-hash.git@master", - 'storage': 'git://github.com/yohanboniface/Leaflet.Storage.git@master', - 'edit_in_osm': 'git://github.com/yohanboniface/Leaflet.EditInOSM.git@master', - 'minimap': 'git://github.com/Norkart/Leaflet-MiniMap.git@master', - 'i18n': 'git://github.com/yohanboniface/Leaflet.i18n.git@master', - 'csv2geojson': 'git://github.com/mapbox/csv2geojson.git@gh-pages', - 'togeojson': 'git://github.com/mapbox/togeojson.git@gh-pages#v0.4.2', - 'osmtogeojson': 'git://github.com/tyrasd/osmtogeojson.git@gh-pages#2.0.5', - 'loading': 'git://github.com/ebrelsford/Leaflet.loading.git@master#v0.1.6', - 'contextmenu': 'git://github.com/aratcliffe/Leaflet.contextmenu.git@master', - '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(): - if name and name != subdir: - continue - repository, branch = path.split('@') - if "#" in branch: - branch, ref = branch.split('#') - else: - ref = branch - with hide("running", "stdout"): - exists = run_as_umap('if [ -d "{0}" ]; then echo 1; fi'.format(subdir)) - if exists: - with cd(subdir): - run_as_umap('git checkout {0}'.format(branch)) - run_as_umap('git pull origin {0} --tags'.format(branch)) - else: - run_as_umap('git clone {0} {1}'.format(repository, subdir)) - with cd(subdir): - run_as_umap('git checkout {0}'.format(ref)) - if subdir == "leaflet": - run_as_umap('npm install') - run_as_umap('jake build') - - #============================================================================== # Helper functions #============================================================================== diff --git a/requirements.txt b/requirements.txt index fc4382d2..eb8a4f6b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ requests-oauthlib==0.4.0 requests==2.2.1 simplejson South==0.7.6 -django-leaflet-storage==0.5.0 +django-leaflet-storage==0.6.0 django-pgindex==0.8.2 diff --git a/umap/__init__.py b/umap/__init__.py index 3da0db45..cb2b0c31 100644 --- a/umap/__init__.py +++ b/umap/__init__.py @@ -1,5 +1,5 @@ "Create maps with OpenStreetMap layers in a minute and embed them in your site." -VERSION = (0, 5, 0) +VERSION = (0, 6, 0) __author__ = 'Yohan Boniface' __contact__ = "yb@enix.org" diff --git a/umap/settings/base.py b/umap/settings/base.py index 9b905263..8edfcecd 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -64,30 +64,10 @@ INSTALLED_APPS = ( #============================================================================== import os -import sys import umap as project_module PROJECT_DIR = os.path.dirname(os.path.realpath(project_module.__file__)) -PYTHON_BIN = os.path.dirname(sys.executable) -ve_path = os.path.dirname(os.path.dirname(os.path.dirname(PROJECT_DIR))) -# Assume that the presence of 'activate_this.py' in the python bin/ -# directory means that we're running in a virtual environment. -if os.path.exists(os.path.join(PYTHON_BIN, 'activate_this.py')): - # We're running with a virtualenv python executable. - VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var') -elif ve_path and os.path.exists(os.path.join(ve_path, 'bin', - 'activate_this.py')): - # We're running in [virtualenv_root]/src/[project_name]. - VAR_ROOT = os.path.join(ve_path, 'var') -else: - # Set the variable root to a path in the project which is - # ignored by the repository. - VAR_ROOT = os.path.join(PROJECT_DIR, 'var') - -if not os.path.exists(VAR_ROOT): - os.mkdir(VAR_ROOT) - #============================================================================== # Project URLS and media settings #============================================================================== @@ -101,12 +81,10 @@ LOGIN_REDIRECT_URL = '/' STATIC_URL = '/static/' MEDIA_URL = '/uploads/' -STATIC_ROOT = os.path.join(VAR_ROOT, 'static') -MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads') +STATIC_ROOT = os.path.join('static') +MEDIA_ROOT = os.path.join('uploads') STATICFILES_DIRS = ( - # Fabric will collect leaflet and draw in this dir - os.path.join(PROJECT_DIR, 'remote_static'), os.path.join(PROJECT_DIR, 'static'), ) diff --git a/umap/settings/local.py.sample b/umap/settings/local.py.sample index ede8cab7..9b48a7dd 100644 --- a/umap/settings/local.py.sample +++ b/umap/settings/local.py.sample @@ -81,3 +81,9 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # python manage.py dbshell # CREATE EXTENSION unaccent; UMAP_USE_UNACCENT = False + +# For static deployment +STATIC_ROOT = '/home/umap/.virtualenvs/umap/var/static' + +# For users' statics (geojson mainly) +MEDIA_ROOT = '/home/umap/.virtualenvs/umap/var/uploads' diff --git a/umap/templates/leaflet_storage/js.html b/umap/templates/leaflet_storage/js.html index d0b676e8..3d8cd7d2 100644 --- a/umap/templates/leaflet_storage/js.html +++ b/umap/templates/leaflet_storage/js.html @@ -1,21 +1,21 @@ {% load compress %} {% compress js %} - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + {% endcompress %} {% if locale %}