Skip to content
Snippets Groups Projects
local.py 2.22 KiB
Newer Older
Eliot Berriot's avatar
Eliot Berriot committed
"""
Local settings

- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
Eliot Berriot's avatar
Eliot Berriot committed
"""
# DEBUG
# ------------------------------------------------------------------------------
Eliot Berriot's avatar
Eliot Berriot committed
DEBUG = env.bool("DJANGO_DEBUG", default=True)
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG

# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
Eliot Berriot's avatar
Eliot Berriot committed
SECRET_KEY = env(
    "DJANGO_SECRET_KEY", default="mc$&b=5j#6^bv7tld1gyjp2&+^-qrdy=0sw@r5sua*1zp4fmxc"
)

# Mail settings
# ------------------------------------------------------------------------------
Eliot Berriot's avatar
Eliot Berriot committed
EMAIL_HOST = "localhost"
EMAIL_PORT = 1025

# django-debug-toolbar
# ------------------------------------------------------------------------------
Eliot Berriot's avatar
Eliot Berriot committed
MIDDLEWARE += ("debug_toolbar.middleware.DebugToolbarMiddleware",)

# INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',)

DEBUG_TOOLBAR_CONFIG = {
Eliot Berriot's avatar
Eliot Berriot committed
    "DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"],
    "SHOW_TEMPLATE_CONTEXT": True,
    "SHOW_TOOLBAR_CALLBACK": lambda request: True,
    "JQUERY_URL": "",
}

# django-extensions
# ------------------------------------------------------------------------------
# INSTALLED_APPS += ('django_extensions', )
Eliot Berriot's avatar
Eliot Berriot committed
INSTALLED_APPS += ("debug_toolbar",)

# TESTING
# ------------------------------------------------------------------------------
Eliot Berriot's avatar
Eliot Berriot committed
TEST_RUNNER = "django.test.runner.DiscoverRunner"
# In development, all tasks will be executed locally by blocking until the task returns

# Your local stuff: Below this line define 3rd party library settings

LOGGING = {
Eliot Berriot's avatar
Eliot Berriot committed
    "version": 1,
    "handlers": {"console": {"level": "DEBUG", "class": "logging.StreamHandler"}},
    "loggers": {
        "django.request": {
            "handlers": ["console"],
            "propagate": True,
            "level": "DEBUG",
        "django_auth_ldap": {"handlers": ["console"], "level": "DEBUG"},
Eliot Berriot's avatar
Eliot Berriot committed
        "": {"level": "DEBUG", "handlers": ["console"]},
CSRF_TRUSTED_ORIGINS = [o for o in ALLOWED_HOSTS]