Use django-statici18n in production

This commit is contained in:
Raphael Michel
2016-11-09 19:08:51 +01:00
parent 67951f8984
commit 45b960b97c
7 changed files with 23 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
all: localecompile staticfiles all: localecompile staticfiles jsi18n
production: localecompile staticfiles compress production: localecompile staticfiles compress jsi18n
localecompile: localecompile:
./manage.py compilemessages ./manage.py compilemessages
@@ -14,6 +14,9 @@ staticfiles:
compress: compress:
./manage.py compress ./manage.py compress
jsi18n: localecompile
./manage.py compilejsi18n
test: test:
py.test tests py.test tests

View File

@@ -19,6 +19,7 @@ def contextprocessor(request):
ctx = { ctx = {
'url_name': url.url_name, 'url_name': url.url_name,
'settings': settings, 'settings': settings,
'DEBUG': settings.DEBUG,
} }
_html_head = [] _html_head = []
if hasattr(request, 'event'): if hasattr(request, 'event'):

View File

@@ -1,6 +1,7 @@
{% load compress %} {% load compress %}
{% load staticfiles %} {% load staticfiles %}
{% load i18n %} {% load i18n %}
{% load statici18n %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -9,7 +10,11 @@
{% compress css %} {% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static "pretixcontrol/scss/main.scss" %}" /> <link rel="stylesheet" type="text/x-scss" href="{% static "pretixcontrol/scss/main.scss" %}" />
{% endcompress %} {% endcompress %}
<script type="text/javascript" src="{% url "javascript-catalog" lang=request.LANGUAGE_CODE %}"></script> {% if DEBUG %}
<script type="text/javascript" src="{% url 'javascript-catalog' lang=request.LANGUAGE_CODE %}" async></script>
{% else %}
<script src="{% statici18n LANGUAGE_CODE %}" async></script>
{% endif %}
{% compress js %} {% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script> <script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script> <script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>

View File

@@ -15,7 +15,8 @@ def contextprocessor(request):
return {} return {}
ctx = { ctx = {
'css_file': None 'css_file': None,
'DEBUG': settings.DEBUG,
} }
_html_head = [] _html_head = []
_footer = [] _footer = []

View File

@@ -2,6 +2,7 @@
{% load staticfiles %} {% load staticfiles %}
{% load i18n %} {% load i18n %}
{% load safelink %} {% load safelink %}
{% load statici18n %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -50,7 +51,12 @@
{% trans "If this takes longer than a few minutes, please contact us." %} {% trans "If this takes longer than a few minutes, please contact us." %}
</p> </p>
</div> </div>
<script type="text/javascript" src="{% url 'javascript-catalog' lang=request.LANGUAGE_CODE %}" async></script> {% if DEBUG %}
<script type="text/javascript" src="{% url 'javascript-catalog' lang=request.LANGUAGE_CODE %}" async></script>
{% else %}
<script src="{% statici18n LANGUAGE_CODE %}" async></script>
{% endif %}
{% compress js %} {% compress js %}
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}" async></script> <script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}" async></script>
<script type="text/javascript" src="{% static "moment/moment-with-locales.js" %}" async></script> <script type="text/javascript" src="{% static "moment/moment-with-locales.js" %}" async></script>

View File

@@ -180,6 +180,7 @@ INSTALLED_APPS = [
'django_otp', 'django_otp',
'django_otp.plugins.otp_totp', 'django_otp.plugins.otp_totp',
'django_otp.plugins.otp_static', 'django_otp.plugins.otp_static',
'statici18n',
] ]
try: try:

View File

@@ -16,6 +16,7 @@ python-u2flib-server==4.*
# until the following issue is fixed, we need our own celery version # until the following issue is fixed, we need our own celery version
# https://github.com/celery/celery/pull/3199 # https://github.com/celery/celery/pull/3199
git+https://github.com/pretix/celery.git@pretix#egg=celery git+https://github.com/pretix/celery.git@pretix#egg=celery
django-statici18n==1.2.*
# Deployment / static file compilation requirements # Deployment / static file compilation requirements
BeautifulSoup4 BeautifulSoup4