kobotoolbox / kobocat

Our (backend) server for providing blank forms to Collect and Enketo and for receiving and storing submissions.
BSD 2-Clause "Simplified" License
117 stars 126 forks source link

Run with `DEBUG=False` by default #660

Open jnm opened 4 years ago

jnm commented 4 years ago

https://github.com/kobotoolbox/kobocat/blob/828081dde9ac211e0ef512f7db3410abf3dcb0f2/onadata/settings/kc_environ.py#L29-L30

noliveleger commented 4 years ago

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

https://github.com/kobotoolbox/kobocat/blob/234dae639a9c86a8e82d193b3b0ef86ec6a0a733/onadata/settings/base.py#L331

jnm commented 4 years ago

quick note in case Josh is working on this :grin: 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:

noliveleger commented 4 years ago

@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. https://github.com/kobotoolbox/kobocat/blob/0cdddf8543b00beaca3b4a7853bbc3e6653d71b8/onadata/settings/prod.py#L10-L11