2017-04-10 23:18:00 +02:00
|
|
|
"""
|
|
|
|
Django development settings for the cof project.
|
|
|
|
The settings that are not listed here are imported from .common
|
|
|
|
"""
|
|
|
|
|
2019-02-12 17:55:23 +01:00
|
|
|
import os
|
|
|
|
|
2017-08-09 21:48:20 +02:00
|
|
|
from .common import * # NOQA
|
2018-01-15 05:26:33 +01:00
|
|
|
from .common import INSTALLED_APPS, MIDDLEWARE, TESTING
|
2017-04-10 23:18:00 +02:00
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
2017-04-10 23:18:00 +02:00
|
|
|
|
|
|
|
DEBUG = True
|
|
|
|
|
2018-01-15 05:26:33 +01:00
|
|
|
if TESTING:
|
2018-10-06 12:35:49 +02:00
|
|
|
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
2018-01-15 05:26:33 +01:00
|
|
|
|
2019-10-05 14:34:30 +02:00
|
|
|
# Only in development mode as long as the events app is not
|
|
|
|
# ready for production
|
|
|
|
INSTALLED_APPS += ["events"]
|
|
|
|
|
2017-04-10 23:18:00 +02:00
|
|
|
|
|
|
|
# ---
|
|
|
|
# Apache static/media config
|
|
|
|
# ---
|
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
STATIC_URL = "/static/"
|
|
|
|
STATIC_ROOT = "/srv/gestiocof/static/"
|
2017-04-10 23:18:00 +02:00
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
MEDIA_ROOT = "/srv/gestiocof/media/"
|
|
|
|
MEDIA_URL = "/media/"
|
2017-04-10 23:18:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Debug tool bar
|
|
|
|
# ---
|
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
|
2017-04-10 23:18:00 +02:00
|
|
|
def show_toolbar(request):
|
|
|
|
"""
|
|
|
|
On ne veut pas la vérification de INTERNAL_IPS faite par la debug-toolbar
|
|
|
|
car cela interfère avec l'utilisation de Vagrant. En effet, l'adresse de la
|
|
|
|
machine physique n'est pas forcément connue, et peut difficilement être
|
|
|
|
mise dans les INTERNAL_IPS.
|
|
|
|
"""
|
2019-02-12 17:55:23 +01:00
|
|
|
env_no_ddt = bool(os.environ.get("DJANGO_NO_DDT", None))
|
|
|
|
return DEBUG and not env_no_ddt and not request.path.startswith("/admin/")
|
2017-04-10 23:18:00 +02:00
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
|
2018-01-15 05:26:33 +01:00
|
|
|
if not TESTING:
|
2019-04-12 17:04:33 +02:00
|
|
|
INSTALLED_APPS += ["debug_toolbar"]
|
2017-11-19 18:41:39 +01:00
|
|
|
|
2019-04-12 17:04:33 +02:00
|
|
|
MIDDLEWARE = ["debug_toolbar.middleware.DebugToolbarMiddleware"] + MIDDLEWARE
|
2017-11-19 18:41:39 +01:00
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_toolbar}
|