0.6.0
This commit is contained in:
parent
517c06a269
commit
e0e5707906
6 changed files with 26 additions and 94 deletions
52
fabfile.py
vendored
52
fabfile.py
vendored
|
@ -166,7 +166,6 @@ def collectstatic():
|
||||||
"""
|
"""
|
||||||
Collect static files from apps and other locations in a single location.
|
Collect static files from apps and other locations in a single location.
|
||||||
"""
|
"""
|
||||||
collect_remote_statics("storage")
|
|
||||||
dj('collectstatic --link --noinput')
|
dj('collectstatic --link --noinput')
|
||||||
dj('storagei18n')
|
dj('storagei18n')
|
||||||
dj('compress')
|
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
|
# Helper functions
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
|
@ -10,5 +10,5 @@ requests-oauthlib==0.4.0
|
||||||
requests==2.2.1
|
requests==2.2.1
|
||||||
simplejson
|
simplejson
|
||||||
South==0.7.6
|
South==0.7.6
|
||||||
django-leaflet-storage==0.5.0
|
django-leaflet-storage==0.6.0
|
||||||
django-pgindex==0.8.2
|
django-pgindex==0.8.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"Create maps with OpenStreetMap layers in a minute and embed them in your site."
|
"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'
|
__author__ = 'Yohan Boniface'
|
||||||
__contact__ = "yb@enix.org"
|
__contact__ = "yb@enix.org"
|
||||||
|
|
|
@ -64,30 +64,10 @@ INSTALLED_APPS = (
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import umap as project_module
|
import umap as project_module
|
||||||
|
|
||||||
PROJECT_DIR = os.path.dirname(os.path.realpath(project_module.__file__))
|
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
|
# Project URLS and media settings
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
@ -101,12 +81,10 @@ LOGIN_REDIRECT_URL = '/'
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
MEDIA_URL = '/uploads/'
|
MEDIA_URL = '/uploads/'
|
||||||
|
|
||||||
STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
|
STATIC_ROOT = os.path.join('static')
|
||||||
MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')
|
MEDIA_ROOT = os.path.join('uploads')
|
||||||
|
|
||||||
STATICFILES_DIRS = (
|
STATICFILES_DIRS = (
|
||||||
# Fabric will collect leaflet and draw in this dir
|
|
||||||
os.path.join(PROJECT_DIR, 'remote_static'),
|
|
||||||
os.path.join(PROJECT_DIR, 'static'),
|
os.path.join(PROJECT_DIR, 'static'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -81,3 +81,9 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
# python manage.py dbshell
|
# python manage.py dbshell
|
||||||
# CREATE EXTENSION unaccent;
|
# CREATE EXTENSION unaccent;
|
||||||
UMAP_USE_UNACCENT = False
|
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'
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
{% load compress %}
|
{% load compress %}
|
||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script src="{{ STATIC_URL }}leaflet/dist/leaflet-src.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/leaflet/leaflet-src.js"></script>
|
||||||
<script src="{{ STATIC_URL }}draw/dist/leaflet.draw-src.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/draw/leaflet.draw-src.js"></script>
|
||||||
<script src="{{ STATIC_URL }}hash/leaflet-hash.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/hash/leaflet-hash.js"></script>
|
||||||
<script src="{{ STATIC_URL }}i18n/Leaflet.i18n.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/i18n/Leaflet.i18n.js"></script>
|
||||||
<script src="{{ STATIC_URL }}edit_in_osm/Leaflet.EditInOSM.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/editinosm/Leaflet.EditInOSM.js"></script>
|
||||||
<script src="{{ STATIC_URL }}minimap/src/Control.MiniMap.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/minimap/src/Control.MiniMap.js"></script>
|
||||||
<script src="{{ STATIC_URL }}csv2geojson/csv2geojson.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/csv2geojson/csv2geojson.js"></script>
|
||||||
<script src="{{ STATIC_URL }}togeojson/togeojson.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/togeojson/togeojson.js"></script>
|
||||||
<script src="{{ STATIC_URL }}osmtogeojson/osmtogeojson.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/osmtogeojson/osmtogeojson.js"></script>
|
||||||
<script src="{{ STATIC_URL }}loading/src/Control.Loading.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/loading/src/Control.Loading.js"></script>
|
||||||
<script src="{{ STATIC_URL }}markercluster/dist/leaflet.markercluster-src.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/markercluster/leaflet.markercluster-src.js"></script>
|
||||||
<script src="{{ STATIC_URL }}measure/leaflet.measurecontrol.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/measure/leaflet.measurecontrol.js"></script>
|
||||||
<script src="{{ STATIC_URL }}contextmenu/dist/leaflet.contextmenu-src.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/contextmenu/leaflet.contextmenu-src.js"></script>
|
||||||
<script src="{{ STATIC_URL }}label/dist/leaflet.label-src.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/label/leaflet.label-src.js"></script>
|
||||||
<script src="{{ STATIC_URL }}georsstogeojson/GeoRSSToGeoJSON.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/georsstogeojson/GeoRSSToGeoJSON.js"></script>
|
||||||
<script src="{{ STATIC_URL }}heat/dist/leaflet-heat.js"></script>
|
<script src="{{ STATIC_URL }}storage/reqs/heat/leaflet-heat.js"></script>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% if locale %}
|
{% if locale %}
|
||||||
<script src="{{ STATIC_URL }}storage/src/locale/{{ locale }}.js"></script>
|
<script src="{{ STATIC_URL }}storage/src/locale/{{ locale }}.js"></script>
|
||||||
|
|
Loading…
Reference in a new issue