forked from CGM_Public/pretix_original
Show warnings about development mode and DEBUG mode
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import sys
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import Resolver404, get_script_prefix, resolve
|
from django.core.urlresolvers import Resolver404, get_script_prefix, resolve
|
||||||
|
|
||||||
@@ -46,4 +47,9 @@ def contextprocessor(request):
|
|||||||
ctx['js_date_format'] = get_javascript_format('DATE_INPUT_FORMATS')
|
ctx['js_date_format'] = get_javascript_format('DATE_INPUT_FORMATS')
|
||||||
ctx['js_locale'] = get_moment_locale()
|
ctx['js_locale'] = get_moment_locale()
|
||||||
|
|
||||||
|
if settings.DEBUG and 'runserver' not in sys.argv:
|
||||||
|
ctx['debug_warning'] = True
|
||||||
|
elif 'runserver' in sys.argv:
|
||||||
|
ctx['development_warning'] = True
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|||||||
@@ -174,6 +174,12 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if debug_warning %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{% trans "pretix is running in debug mode. For security reasons, please never run debug mode on a production instance." %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<footer>
|
<footer>
|
||||||
@@ -182,6 +188,9 @@
|
|||||||
powered by <a {{ a_attr }}>pretix</a>
|
powered by <a {{ a_attr }}>pretix</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
{% if development_warning %}
|
||||||
|
<span class="text-warning">· {% trans "running in development mode" %}</span>
|
||||||
|
{% endif %}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user