From: Guillaume Pellerin Date: Fri, 12 Aug 2022 07:07:55 +0000 (+0200) Subject: use INTERNAL_IPS to detect debug mode in template, use DEBUG for the debug X-Git-Tag: 2.8.0~45 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=344ff3089c8f262704211a422df10f181238de43;p=teleforma.git use INTERNAL_IPS to detect debug mode in template, use DEBUG for the debug toolbar --- diff --git a/app/settings.py b/app/settings.py index 996ccb06..97f8ef63 100644 --- a/app/settings.py +++ b/app/settings.py @@ -5,6 +5,7 @@ from django.utils.encoding import force_text import warnings import os import sys +import socket from django.urls import reverse_lazy # import environ @@ -16,10 +17,6 @@ TEMPLATE_DEBUG = DEBUG RECOVERY = False -# disable to debug websocket and improve performance -DEBUG_TOOLBAR = False - - BASE_DIR = os.path.dirname(os.path.dirname(__file__)) warnings.showwarning = lambda *x: None @@ -41,6 +38,13 @@ ALLOWED_HOSTS = ['localhost', 'crfpa.dockdev.pilotsystems.net', ASGI_APPLICATION = "teleforma.ws.routing.application" + +INTERNAL_IPS = ['127.0.0.1', ] + +# tricks to have debug toolbar when developing with docker +ip = socket.gethostbyname(socket.gethostname()) +INTERNAL_IPS += [ip[:-1] + '1'] + REDIS_HOST = "redis" REDIS_PORT = 6379 @@ -159,7 +163,7 @@ TEMPLATE_LOADERS = ( )), ) -MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOLBAR else ()) + ( +MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG else ()) + ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -200,7 +204,7 @@ INSTALLED_APPS = ( ) -if DEBUG_TOOLBAR: +if DEBUG: INSTALLED_APPS += ('debug_toolbar',) TEMPLATES = [ @@ -505,7 +509,7 @@ SHERLOKS_USE_TRANSACTION_ID = True ORAL_OPTION_PRICE = 250 -if DEBUG_TOOLBAR: +if DEBUG: def show_toolbar(request): return True DEBUG_TOOLBAR_CONFIG = { diff --git a/teleforma/templates/teleforma/base.html b/teleforma/templates/teleforma/base.html index fc6e34ac..17709f54 100644 --- a/teleforma/templates/teleforma/base.html +++ b/teleforma/templates/teleforma/base.html @@ -257,72 +257,81 @@ {% block extra_javascript %}{% endblock %} - + {% if not debug %} - - "hashtag": "#tarteaucitron", - /* Open the panel with this hashtag */ - "cookieName": "tarteaucitron", - /* Cookie name */ + + "readmoreLink": "", + /* Change the default readmore link */ - {% endblock %} + "mandatory": true, + /* Show a message about mandatory cookies */ + }); + + + + + + {% endif %} - - {% webpack 'app.js' %} + + {% endblock %} + \ No newline at end of file