Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run with DEBUG=False by default #660

Open
jnm opened this issue Oct 21, 2020 · 3 comments · Fixed by #683
Open

Run with DEBUG=False by default #660

jnm opened this issue Oct 21, 2020 · 3 comments · Fixed by #683
Assignees

Comments

@jnm
Copy link
Member

jnm commented Oct 21, 2020

DEBUG = os.environ.get('DJANGO_DEBUG', 'True') == 'True'
TEMPLATE_DEBUG = os.environ.get('TEMPLATE_DEBUG', 'True') == 'True'

@noliveleger
Copy link
Contributor

noliveleger commented Oct 21, 2020

@jnm I would recommend to apply the changes only in last version of KoBoCAT (Django 2/ Python 3) to avoid conflicts.

DEBUG = os.environ.get('DJANGO_DEBUG', 'True') == 'True'

@joshuaberetta joshuaberetta self-assigned this Oct 21, 2020
@jnm
Copy link
Member Author

jnm commented Oct 22, 2020

quick note in case Josh is working on this 😁
i'm not entirely sure what TEMPLATE_DEBUG actually does, or why we would need to toggle it separately from DEBUG. at first blush, i'd say:

  • make TEMPLATE_DEBUG simply follow DEBUG (instead of reading from the environment)
  • continue to read DEBUG from the environment, but default to false

@noliveleger
Copy link
Contributor

noliveleger commented Oct 22, 2020

@jnm, @joshuaberetta
FYI: TEMPLATE_DEBUG is deprecated anyway (since 2.0 I think)

I did change it in KoBoCAT upgrade

In case GH does not follow the link, look at debug property of TEMPLATES.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'APP_DIRS': False,
        'DIRS': [
            os.path.join(TEMPLATE_OVERRIDE_ROOT_DIR, 'templates'),
            os.path.join(ONADATA_DIR, 'libs/templates')
        ],
        'OPTIONS': {
            'context_processors': [
                'onadata.koboform.context_processors.koboform_integration',
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.template.context_processors.request',
                'django.contrib.messages.context_processors.messages',
                'readonly.context_processors.readonly',
                'onadata.apps.main.context_processors.google_analytics',
                'onadata.apps.main.context_processors.site_name',
                'onadata.apps.main.context_processors.base_url'
            ],
            'loaders': [
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
            ]
            ],
            'debug': os.environ.get('TEMPLATE_DEBUG', 'False') == 'True',
        },
    }
]

Note that is enforced to False on production in latest version of Django2/Python3 upgrade of KoBoCAT.

DEBUG = False
TEMPLATES[0]['OPTIONS']['debug'] = False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants