2017-08-09 21:48:20 +02:00
|
|
|
"""
|
2020-05-09 11:49:05 +02:00
|
|
|
Django local development settings for the cof project.
|
2017-08-09 21:48:20 +02:00
|
|
|
The settings that are not listed here are imported from .common
|
|
|
|
"""
|
|
|
|
|
2017-08-11 18:24:09 +02:00
|
|
|
import os
|
|
|
|
|
2020-05-09 11:49:05 +02:00
|
|
|
from .common import * # NOQA
|
|
|
|
from .common import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, TESTING
|
|
|
|
|
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
|
|
|
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
if TESTING:
|
|
|
|
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
|
|
|
|
|
|
|
# As long as these apps are not ready for production, they are only available
|
|
|
|
# in development mode
|
|
|
|
INSTALLED_APPS += ["events", "bds", "clubs"]
|
|
|
|
|
|
|
|
STATIC_URL = "/static/"
|
|
|
|
MEDIA_URL = os.path.join(BASE_DIR, "media")
|
2017-08-09 21:48:20 +02:00
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.sqlite3",
|
2018-10-06 12:35:49 +02:00
|
|
|
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
2017-08-09 21:48:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Use the default cache backend for local development
|
2018-10-06 12:35:49 +02:00
|
|
|
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
|
2017-08-09 21:48:20 +02:00
|
|
|
|
|
|
|
# Use the default in memory asgi backend for local development
|
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "asgiref.inmemory.ChannelLayer",
|
|
|
|
"ROUTING": "cof.routing.routing",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-09 11:49:05 +02:00
|
|
|
|
|
|
|
# ---
|
|
|
|
# Debug tool bar
|
|
|
|
# ---
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
|
|
|
env_no_ddt = bool(os.environ.get("DJANGO_NO_DDT", None))
|
|
|
|
return DEBUG and not env_no_ddt and not request.path.startswith("/admin/")
|
|
|
|
|
|
|
|
|
|
|
|
if not TESTING:
|
|
|
|
INSTALLED_APPS += ["debug_toolbar"]
|
|
|
|
MIDDLEWARE = ["debug_toolbar.middleware.DebugToolbarMiddleware"] + MIDDLEWARE
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_toolbar}
|