-
Notifications
You must be signed in to change notification settings - Fork 2
/
dev.py
95 lines (66 loc) · 2.54 KB
/
dev.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os
import platform
from .base import * # noqa
DEBUG = True
INSTALLED_APPS += ["django_extensions", "debug_toolbar"] # noqa F405
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"] # noqa F405
ALLOWED_HOSTS = [
"localhost",
"127.0.0.1",
"0.0.0.0",
os.environ.get("CURRENT_HOST"),
# for review apps (in case you want to change the DEBUG value)
".cleverapps.io",
]
# For Docker env (and debug toolbar in particular)
import socket
_, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips] + ["127.0.0.1"]
# Authentication.
# ------------------------------------------------------------------------------
AUTH_PASSWORD_VALIDATORS = [] # Avoid password strength validation in DEV.
# Static files.
# ------------------------------------------------------------------------------
COMPRESS_ENABLED = False
COMPRESS_OFFLINE = False
# Emails.
# ------------------------------------------------------------------------------
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
# EMAIL_FILE_PATH = str(ROOT_DIR + "sent_emails")
# Security.
# ------------------------------------------------------------------------------
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
# django-extensions settings.
# https://django-extensions.readthedocs.io/en/latest/index.html
# ----------------------------------------------------
SHELL_PLUS = "ipython"
SHELL_PLUS_IMPORTS = [
"import csv, json, yaml",
"from datetime import datetime, date, timedelta",
]
# django-debug-toolbar settings.
# https://django-debug-toolbar.readthedocs.io/en/latest/
# ----------------------------------------------------
DEBUG_TOOLBAR_CONFIG = {
# https://django-debug-toolbar.readthedocs.io/en/latest/panels.html#panels
"DISABLE_PANELS": [
"debug_toolbar.panels.redirects.RedirectsPanel",
# ProfilingPanel makes the django admin extremely slow...
"debug_toolbar.panels.profiling.ProfilingPanel",
],
"SHOW_TEMPLATE_CONTEXT": True,
}
# see https://docs.python.org/3/library/platform.html#platform.win32_ver
is_windows = any(platform.win32_ver())
if is_windows:
# Postgis Django needs GDAL
# https://trac.osgeo.org/osgeo4w/
GDAL_LIBRARY_PATH = "C:/OSGeo4W/bin/gdal304.dll"
# flake8: noqa F405
HUEY |= {
"results": True,
"store_none": True,
} # Huey implementation to use.
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"