Update lots of things

This commit is contained in:
Livvy Mackintosh 2017-06-16 18:06:22 +02:00
parent 90b508e3b0
commit 0811936382
23 changed files with 557 additions and 106 deletions

View File

@ -16,6 +16,7 @@ SHELL ["/bin/bash","-ex","-c"]
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y\ RUN apt-get update && apt-get install -y\
build-essential\ build-essential\
closure-compiler\
cron\ cron\
locales\ locales\
libgdal-dev\ libgdal-dev\

View File

@ -1,4 +1,6 @@
from django.contrib import admin from django.contrib import admin
from apps.map.models import CaseStudy from leaflet.admin import LeafletGeoAdmin
admin.site.register(CaseStudy) from .models import CaseStudy
admin.site.register(CaseStudy, LeafletGeoAdmin)

25
apps/map/forms.py Normal file
View File

@ -0,0 +1,25 @@
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from leaflet.forms.widgets import LeafletWidget
from .models import CaseStudy
class CaseStudyForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(CaseStudyForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'case-study-form'
self.helper.form_class = 'form-horizontal'
self.helper.form_method = 'post'
self.helper.form_action = 'submit'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-8'
self.helper.add_input(Submit('submit', 'Submit'))
class Meta:
model = CaseStudy
fields = '__all__'
widgets = {'location': LeafletWidget()}

View File

@ -25,10 +25,9 @@ class CaseStudy(models.Model):
editable=False editable=False
) )
project_name = models.CharField(max_length=128)
# Location of map pin # Location of map pin
location = models.PointField() location = models.PointField()
project_name = models.CharField(max_length=128)
supply_chain = models.CharField( supply_chain = models.CharField(
max_length=1, max_length=1,
choices=SUPPLY_CHAIN_CHOICES choices=SUPPLY_CHAIN_CHOICES

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,15 @@
{% load staticfiles %}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/"><img src="{% static "map/ojuso-logo-white.png" %}" alt="Ojuso Logo"></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
{% block nav_links %}
{% endblock %}
</ul>
</div>
</div>
</nav>

View File

@ -0,0 +1,67 @@
{% spaceless %}
{% load bootstrap3 %}
{% load compress %}
{% load i18n %}
{% load leaflet_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
{# Metadata #}
<meta charset="UTF-8">
<meta name="viewport" content"width=device-width, initial-scale=2">
<title>{% trans "Ojuso Platform Map" %}</title>
<meta name="description" content="">
<meta name="author" content="">
{# CDN Stylesheets #}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"
rel="stylesheet"/>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js">
integrity="sha384-qFIkRsVO/J5orlMvxK1sgAt2FXT67og+NyFTITYzvbIP1IJavVEKZM7YWczXkwpB"
crossorigin="anonymous">
</script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"
integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo"
crossorigin="anonymous">
</script>
<![endif]-->
{# Additional Stylesheets #}
{% compress css %}
{% block stylesheets %}
<style>
.navbar-brand {padding: 5px 15px;}
.navbar-brand > img {height: 40px;}
</style>
{% endblock %}
{% endcompress %}
</head>
<body>
{# Main Markup #}
{% block body %}{% endblock %}
{# CDN Javascript #}
<script src="//code.jquery.com/jquery-3.2.1.min.js"
integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f"
crossorigin="anonymous">
</script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous">
</script>
{# Additional Scripts #}
{% block scripts %}{% endblock %}
</body>
</html>
{% endspaceless %}

View File

@ -0,0 +1,34 @@
{% extends "map/base.html" %}
{% block stylesheets %}
{{ block.super }}
<style>
body {
padding-top: 50px;
}
.page-lead {
padding: 40px 15px;
text-align: center;
}
</style>
{% endblock %}
{% block body %}
{% include "map/_nav.html" %}
{% block nav_links %}
<li><a href="/case-studies">Case Studies</a></li>
{% endblock %}
<div class="container">
<div class="page-lead">
<h1>{% block title %}{% endblock %}</h1>
<p class="lead">{% block description %}{% endblock %}</p>
</div>
{% block content %}
{% endblock %}
</div><!-- /.container -->
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends "map/base.html" %}
{% block stylesheets %}
{{ block.super }}
<style>
body {
padding-top: 50px;
}
.jumbo {
height: calc(100% - 50px);
width: 100%;
position: absolute;
right: 0;
bottom: 0;
left: 0;
}
</style>
{% endblock %}
{% block body %}
{% include "map/_nav.html" %}
<div class="jumbo">
{% block content %}
{% endblock %}
</div><!-- /.container -->
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends "map/base_with_container.html" %}
{% load compress %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load leaflet_tags %}
{% block stylesheets %}
{{ block.super }}
{% leaflet_css %}
<style> html, body, #main { width: 100; height:100%; } </style>
{% endblock %}
{% block title %}{% trans "Submit a Case Study" %}{% endblock %}
{% block description %}{% trans "Here you can submit a case study for review and it will be added to the map." %}{% endblock %}
{% block content %}
{% crispy form %}
{% endblock %}
{% block scripts %}
{% leaflet_js %}
{% endblock %}

View File

@ -1,56 +1,113 @@
{% extends "map/base_with_jumbo.html" %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load compress %}
{% load i18n %} {% load i18n %}
{% load leaflet_tags %} {% load leaflet_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% trans "Ojuso Platform Map" %}</title>
<meta name="viewport" content"width=device-width, initial-scale=2">
{% bootstrap_css %}
{% leaflet_js %}
{% leaflet_css %}
<style>
html, body, #main {
width: 100%;
height:100%;
}
</style>
</head>
<body>
<h1>Ojuso Platform Map</h1>
{% leaflet_map "main" callback="main_app_init" %}
<div id="modals"></div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous">
</script>
{% bootstrap_javascript %}
<script type="text/javascript">
function create(htmlStr) {
var frag = document.createDocumentFragment(),
temp = document.createElement('div');
temp.innerHTML = htmlStr;
while (temp.firstChild) {
frag.appendChild(temp.firstChild);
}
return frag;
}
function main_app_init(map, options) {
$.getJSON('/api/case-studies/', function (data) {
L.geoJson(data, {
onEachFeature: function (feature, layer) {
var modalname = "case-study-"+feature.id
layer.bindPopup(
"<h3>"+feature.properties.project_name+"</h3>"+"<button type='button' class='btn btn-primary btn-block' data-toggle='modal' data-target='#"+modalname+"'>"+"<span class='glyphicon glyphicon-file' aria-hidden='true'></span>"+"View Details"+"</button>"
);
var modal = create("<div class='modal fade' id='"+modalname+"' tabindex='-1' role='dialog' aria-labelledby='"+modalname+"-label'><div class='modal-dialog' role='document'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button><h4 class='modal-title' id='"+modalname+"-label'>"+feature.properties.project_name+"</h4></div><div class='modal-body'><p>"+feature.properties.description+"</p></div><div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Close</button><button type='button' class='btn btn-primary'>Save changes</button></div></div></div></div>");
document.getElementById('modals').appendChild(modal);
}
}).addTo(map);
});
}
</script>
</body>
</html>
{% block stylesheets %}
{{ block.super }}
{% leaflet_css %}
<style> html, body, #main { width: 100; height:100%; } </style>
{% endblock %}
{% block title %}{% trans "Ojuso Platform Map" %}{% endblock %}
{% block content %}
<div id="main"></div>
<div id="modals"></div>
{% endblock %}
{% block scripts %}
{% leaflet_map "main" callback="main_app_init" creatediv=False %}
{% leaflet_js %}
<script type="text/javascript">
// This takes HTML as a string and returns an element
function create(htmlStr) {
var frag = document.createDocumentFragment(),
temp = document.createElement('div');
temp.innerHTML = htmlStr;
while (temp.firstChild) {
frag.appendChild(temp.firstChild);
}
return frag;
}
// This is called when the map is initialized
function main_app_init(map, options) {
// Pull data as GeoJSON and add to map with a modal
$.getJSON('/api/case-studies/', function (data) {
L.geoJson(data, {
onEachFeature: function (feature, layer) {
var modalname = "case-study-"+feature.id
layer.bindPopup(
"<h3>"+feature.properties.project_name+"</h3>"+
"<button type='button' class='btn btn-primary btn-block' data-toggle='modal' data-target='#"+modalname+"'>"
+"{% trans "Quick View" %}"+"</button>"
);
var modal = create(
"<div class='modal fade' id='"+modalname+"' tabindex='-1' role='dialog' aria-labelledby='"+modalname+"-label'>"+
"<div class='modal-dialog' role='document'>"+
"<div class='modal-content'>"+
"<div class='modal-header'>"+
"<button type='button' class='close' data-dismiss='modal' aria-label='{% trans "Close" %}'>"+
"<span aria-hidden='true'>&times;</span>"+
"</button>"+
"<h4 class='modal-title' id='"+modalname+"-label'>"+
feature.properties.project_name+
"</h4>"+
"</div>"+
"<div class='modal-body'>"+
"<p>"+feature.properties.description+"</p>"+
"<dl class='dl-horizontal'>"+
"<dt>Supply Chain</dt><dd>"+feature.properties.supply_chain+"</dd>"+
"<dt>Generation Type</dt><dd>"+feature.properties.generation_type+"</dd>"+
"<dt>Associated Companies</dt><dd>"+feature.properties.associated_companies+"</dd>"+
"<dt>Financiers</dt><dd>"+feature.properties.financiers+"</dd>"+
"<dt>Important Lenders</dt><dd>"+feature.properties.important_lenders+"</dd>"+
"<dt>Country</dt><dd>"+feature.properties.country+"</dd>"+
"<dt>Affects Indigenous</dt><dd>"+feature.properties.affects_indigenous+"</dd>"+
"<dt>Affects Indigenous Reason</dt><dd>"+feature.properties.affects_indigenous_reason+"</dd>"+
"<dt>Proposed Start</dt><dd>"+feature.properties.proposed_start+"</dd>"+
"<dt>Proposed Completion</dt><dd>"+feature.properties.proposed_completion+"</dd>"+
"<dt>Link to Forum</dt><dd>"+feature.properties.link_to_forum+"</dd>"+
"<dt>Image</dt><dd>"+feature.properties.image+"</dd>"+
"<dt>References</dt><dd>"+feature.properties.references+"</dd>"+
"<dt>Commodities</dt><dd>"+feature.properties.commodities+"</dd>"+
"<dt>Like to Engage Developer</dt><dd>"+feature.properties.like_to_engage_developer+"</dd>"+
"<dt>Like to Engage Investors</dt><dd"+feature.properties.like_to_engage_investors+"></dd>"+
"<dt>Author</dt><dd>"+feature.properties.author+"</dd>"+
"</dl>"+
"</div>"+
"<div class='modal-footer'>"+
"<button type='button' class='btn btn-default' data-dismiss='modal'>"+
"{% trans "Close" %}"+
"</button>"+
"<button type='button' class='btn btn-primary'>"+
"{% trans "Save changes" %}"+
"</button>"+
"</div>"+
"</div>"+
"</div>"+
"</div>"
);
document.getElementById('modals').appendChild(modal);
}
}).addTo(map);
});
// Add an on-click listener for map click events. Show popup with button to submit a casestudy
map.on('click', function(e) {
var popup = L.popup()
.setLatLng(e.latlng)
.setContent("<a class='btn btn-primary btn-sm' href='case-study/add?lat="+e.latlng.lat+"&lng="+e.latlng.lng+"' role='button'>{% trans "Submit a Case Study" %}</a>")
.openOn(map);
});
}
</script>
{% endblock %}

View File

@ -8,5 +8,6 @@ urlpatterns = [
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^data.geojson$', url(r'^data.geojson$',
GeoJSONLayerView.as_view(model=CaseStudy, geometry_field='location'), GeoJSONLayerView.as_view(model=CaseStudy, geometry_field='location'),
name='data') name='data'),
url(r'^case-study/add', views.form, name='form')
] ]

View File

@ -1,5 +1,12 @@
from django.shortcuts import render from django.shortcuts import render
from .forms import CaseStudyForm
def index(request): def index(request):
return render(request, 'map/index.html') return render(request, 'map/index.html')
def form(request):
form = CaseStudyForm
return render(request, 'map/form.html', {'form': form})

View File

@ -1,27 +1,27 @@
#!/bin/bash #!/bin/bash
# Create Discourse # Create Discourse
docker run -d --restart=always docker run -d --restart=always \
-e LANG=en_US.UTF-8 \ -e LANG=en_US.UTF-8 \
-e RAILS_ENV=production \ -e RAILS_ENV=production \
-e UNICORN_WORKERS=4 \ -e UNICORN_WORKERS=4 \
-e UNICORN_SIDEKIQS=1 \ -e UNICORN_SIDEKIQS=1 \
-e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \ -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
-e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 \ -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 \
-e RUBY_GC_HEAP_INIT_SLOTS=400000 \ -e RUBY_GC_HEAP_INIT_SLOTS=400000 \
-e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 \ -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 \
-e DISCOURSE_DB_SOCKET=/var/run/postgresql \ -e DISCOURSE_DB_SOCKET=/var/run/postgresql \
-e LETSENCRYPT_DIR=/shared/letsencrypt \ -e LETSENCRYPT_DIR=/shared/letsencrypt \
-e DISCOURSE_HOSTNAME=forum.ojuso.org \ -e DISCOURSE_HOSTNAME=forum.ojuso.org \
-e DISCOURSE_DEVELOPER_EMAILS=admin@ojuso.org \ -e DISCOURSE_DEVELOPER_EMAILS=admin@ojuso.org \
-e DISCOURSE_SMTP_ADDRESS=mail.gandi.net \ -e DISCOURSE_SMTP_ADDRESS=mail.gandi.net \
-e DISCOURSE_SMTP_PORT=587 \ -e DISCOURSE_SMTP_PORT=587 \
-e DISCOURSE_SMTP_USER_NAME=admin@ojuso.org \ -e DISCOURSE_SMTP_USER_NAME=admin@ojuso.org \
-e DISCOURSE_SMTP_PASSWORD=QN7yosrnch1le474H56mesVR1SRw6sfO3izJDZnJ6T62Cj9I57CplW6UYZY6VXsq7lLr868bIK3kSXGyWiSrAyWK \ -e DISCOURSE_SMTP_PASSWORD=QN7yosrnch1le474H56mesVR1SRw6sfO3izJDZnJ6T62Cj9I57CplW6UYZY6VXsq7lLr868bIK3kSXGyWiSrAyWK \
-e LETSENCRYPT_ACCOUNT_EMAIL=admin@ojuso.org -h energy-app \ -e LETSENCRYPT_ACCOUNT_EMAIL=admin@ojuso.org -h energy-app \
-e DOCKER_HOST_IP=172.17.0.1 \ -e DOCKER_HOST_IP=172.17.0.1 \
--name app \ --name app \
-t -p 80:80 -p 443:443 \ -p 80:80 -p 443:443 \
-v /var/discourse/shared/standalone:/shared \ -v /var/discourse/shared/standalone:/shared \
-v /var/discourse/shared/standalone/log/var-log:/var/log \ -v /var/discourse/shared/standalone/log/var-log:/var/log \
--mac-address 02:2d:a6:d4:85:4a \ --mac-address 02:2d:a6:d4:85:4a \
local_discourse/app /sbin/boot local_discourse/app /sbin/boot

23
bin/sri-hash Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
usage="Usage: $(basename "$0") URL
Generate the subresource integrity hash (SRI) of URL.
--help display this help and exit"
seed=42
while getopts ':hs-help:' option; do
case "$option" in
h) echo "$usage"
exit
;;
:) printf "missing argument for -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
esac
done
echo sha384-$(curl -s $1 | openssl dgst -sha384 -binary | openssl enc -base64 -A)

45
environment.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash -e
export DEBUG=0
export ALLOWED_HOSTS=map.ojuso.org
export DATABASE_HOST=localhost
export DATABASE_NAME=postgres
export DATABASE_PASSWORD=2xXKKS9zdrBX9QJaV5Z5NPTiiW8LtTiR4vAGSACddqFTrBdhgwZHKYnLqjJedAi3
export EMAIL_HOST=mail.gandi.net
export EMAIL_HOST_USER=admin@ojuso.org
export EMAIL_HOST_PASSWORD=QN7yosrnch1le474H56mesVR1SRw6sfO3izJDZnJ6T62Cj9I57CplW6UYZY6VXsq7lLr868bIK3kSXGyWiSrAyWK
export EMAIL_PORT=587
export EMAIL_USE_TLS=1
export SECRET_KEY=a3DfjSmWkSffsPscRscqaxGv6HsBN8VKL8Q4EU4QcdEckB8scogrMP4tv7Eo7LZw
export SERVER_EMAIL=Ojuso\ Platform\ Notification\ \<admin@ojuso.org\>
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=2xXKKS9zdrBX9QJaV5Z5NPTiiW8LtTiR4vAGSACddqFTrBdhgwZHKYnLqjJedAi3
export DISCOURSE_DB_SOCKET=/var/run/postgresql
export DISCOURSE_DEVELOPER_EMAILS=admin@ojuso.org
export DISCOURSE_HOSTNAME=forum.ojuso.org
export DISCOURSE_SMTP_ADDRESS=mail.gandi.net
export DISCOURSE_SMTP_PASSWORD=QN7yosrnch1le474H56mesVR1SRw6sfO3izJDZnJ6T62Cj9I57CplW6UYZY6VXsq7lLr868bIK3kSXGyWiSrAyWK
export DISCOURSE_SMTP_PORT=587
export DISCOURSE_SMTP_USER_NAME=admin@ojuso.org
export DOCKER_HOST_IP=172.17.0.1
export LANG=en_US.UTF-8
export RAILS_ENV=production
export RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000
export RUBY_GC_HEAP_INIT_SLOTS=400000
export RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5
export RUBY_GLOBAL_METHOD_CACHE_SIZE=131072
export UNICORN_SIDEKIQS=1
export UNICORN_WORKERS=4
export WEBLATE_DEBUG=0
export WEBLATE_LOGLEVEL=DEBUG
export WEBLATE_SITE_TITLE=Ojuso\ Weblate
export WEBLATE_ADMIN_NAME=Weblate\ Admin
export WEBLATE_ADMIN_EMAIL=admin@ojuso.org
export WEBLATE_ADMIN_PASSWORD=zPFPtHLsRRFAAcApeGd23aV6Hg66KpTkWs2becsMMoL9dTeKLNt3PfH5Bzhyna8q
export WEBLATE_SERVER_EMAIL=noreply@ojuso.org
export WEBLATE_DEFAULT_FROM_EMAIL=noreply@ojuso.org
export WEBLATE_ALLOWED_HOSTS=*
export WEBLATE_REGISTRATION_OPEN=1
export WEBLATE_GITHUB_USERNAME=livmackintosh
export WEBLATE_EMAIL_HOST=mail.gandi.net
export WEBLATE_EMAIL_USER=admin@ojuso.org
export WEBLATE_EMAIL_PASSWORD=QN7yosrnch1le474H56mesVR1SRw6sfO3izJDZnJ6T62Cj9I57CplW6UYZY6VXsq7lLr868bIK3kSXGyWiSrAyWK

View File

@ -45,6 +45,7 @@ INSTALLED_APPS = [
'django.contrib.gis', 'django.contrib.gis',
'bootstrap3', 'bootstrap3',
'cas_server', 'cas_server',
'compressor',
'crispy_forms', 'crispy_forms',
'django_extensions', 'django_extensions',
'leaflet', 'leaflet',
@ -158,6 +159,13 @@ LOCALE_PATHS = [
STATIC_ROOT = os.path.join(BASE_DIR, 'static/') STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = os.getenv("STATIC_URL", '/static/') STATIC_URL = os.getenv("STATIC_URL", '/static/')
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
]
# Cache # Cache
# https://docs.djangoproject.com/en/1.11/topics/cache/ # https://docs.djangoproject.com/en/1.11/topics/cache/
@ -191,3 +199,21 @@ REST_FRAMEWORK = {
'rest_framework.parsers.JSONParser', 'rest_framework.parsers.JSONParser',
) )
} }
# Django Crispy Forms
# http://django-crispy-forms.readthedocs.io/en/latest/
CRISPY_TEMPLATE_PACK = 'bootstrap3'
# Django-Leaflet
# https://django-leaflet.readthedocs.io/en/latest/
LEAFLET_CONFIG = {
'MIN_ZOOM': 3,
'MAX_ZOOM': 16,
'PLUGINS': {
'forms': {
'auto-include': True
}
},
}

View File

@ -17,7 +17,6 @@ from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.models import User from django.contrib.auth.models import User
from apps.map.models import CaseStudy from apps.map.models import CaseStudy
from django.views.generic.base import RedirectView
from rest_framework import routers, serializers, viewsets from rest_framework import routers, serializers, viewsets
from rest_framework_gis import serializers as gis_serializers from rest_framework_gis import serializers as gis_serializers
@ -48,9 +47,8 @@ apirouter.register(r'users', UserViewSet)
apirouter.register(r'case-studies', CaseStudyViewSet) apirouter.register(r'case-studies', CaseStudyViewSet)
urlpatterns = [ urlpatterns = [
url(r'^$', RedirectView.as_view(url="/beta/")), url(r'', include('apps.map.urls'), name="map"),
url(r'api/', include(apirouter.urls)), url(r'api/', include(apirouter.urls)),
url(r'^beta/', include('apps.map.urls'), name="beta"),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^cas/', include('cas_server.urls', namespace='cas_server')), url(r'^cas/', include('cas_server.urls', namespace='cas_server')),
] ]

View File

@ -1,7 +1,9 @@
appdirs==1.4.3 appdirs==1.4.3
Django==1.10.7 Django==1.10.7
django-appconf==1.0.2
django-bootstrap3==8.2.3 django-bootstrap3==8.2.3
django-cas-server==0.8.0 django-cas-server==0.8.0
django-compressor==2.1.1
django-countries==4.5 django-countries==4.5
django-crispy-forms==1.6.1 django-crispy-forms==1.6.1
django-extensions==1.7.9 django-extensions==1.7.9
@ -18,6 +20,8 @@ psycopg2==2.7.1
pyparsing==2.2.0 pyparsing==2.2.0
python-memcached==1.58 python-memcached==1.58
pytz==2017.2 pytz==2017.2
rcssmin==1.0.6
requests==2.14.2 requests==2.14.2
requests-futures==0.9.7 requests-futures==0.9.7
rjsmin==1.0.12
six==1.10.0 six==1.10.0

View File

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-16 16:05+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/map/templates/map/base.html:15 apps/map/templates/map/index.html:15
msgid "Ojuso Platform Map"
msgstr ""
#: apps/map/templates/map/form.html:15 apps/map/templates/map/index.html:108
msgid "Submit a Case Study"
msgstr ""
#: apps/map/templates/map/form.html:16
msgid ""
"Here you can submit a case study for review and it will be added to the map."
msgstr ""
#: apps/map/templates/map/index.html:51
msgid "Quick View"
msgstr ""
#: apps/map/templates/map/index.html:58 apps/map/templates/map/index.html:89
msgid "Close"
msgstr ""
#: apps/map/templates/map/index.html:92
msgid "Save changes"
msgstr ""
#: ojusomap/settings.py:149
msgid "English"
msgstr ""
#: ojusomap/settings.py:150
msgid "Spanish"
msgstr ""

View File

@ -0,0 +1,56 @@
# Enable gzip compression.
# Default: off
gzip on;
# Compression level (1-9).
# 5 is a perfect compromise between size and CPU usage, offering about
# 75% reduction for most ASCII files (almost identical to level 9).
# Default: 1
gzip_comp_level 5;
# Don't compress anything that's already small and unlikely to shrink much
# if at all (the default is 20 bytes, which is bad as that usually leads to
# larger files after gzipping).
# Default: 20
gzip_min_length 256;
# Compress data even for clients that are connecting to us via proxies,
# identified by the "Via" header (required for CloudFront).
# Default: off
gzip_proxied any;
# Tell proxies to cache both the gzipped and regular version of a resource
# whenever the client's Accept-Encoding capabilities header varies;
# Avoids the issue where a non-gzip capable client (which is extremely rare
# today) would display gibberish if their proxy gave them the gzipped version.
# Default: off
gzip_vary on;
# Compress all output labeled with one of the following MIME-types.
# text/html is always compressed by gzip module.
# Default: text/html
gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;

View File

@ -6,8 +6,9 @@ server {
alias /web/acme; alias /web/acme;
} }
return 301 https://$host$request_uri; location / {
return 301 https://$host$request_uri;
}
} }
server { server {
@ -66,12 +67,12 @@ server {
server { server {
listen 443 ssl http2; listen 443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name energy.ojuso.org; server_name i18n.ojuso.org;
ssl_certificate /web/certs/energy.ojuso.org/fullchain.pem; ssl_certificate /web/certs/i18n.ojuso.org/fullchain.pem;
ssl_certificate_key /web/certs/energy.ojuso.org/privkey.pem; ssl_certificate_key /web/certs/i18n.ojuso.org/privkey.pem;
ssl_dhparam /web/certs/dhparam.pem; ssl_dhparam /web/certs/dhparam.pem;
ssl_trusted_certificate /web/certs/energy.ojuso.org/chain.pem; ssl_trusted_certificate /web/certs/i18n.ojuso.org/chain.pem;
include directives/*; include directives/*;
@ -79,21 +80,6 @@ server {
root /web/weblate/data/static; root /web/weblate/data/static;
gzip on;
gzip_proxied any;
gzip_types text/plain
application/atom+xml
application/rss+xml
application/javascript
text/xml
text/css
application/xml
application/json
image/svg+xml
font/opentype
application/x-font-ttf
application/vnd.ms-fontobject;
location /favicon.ico { location /favicon.ico {
alias /web/weblate/data/static/favicon.ico; alias /web/weblate/data/static/favicon.ico;
expires 30d; expires 30d;