| 1 |
# Django settings for example project. |
| 2 |
import os |
| 3 |
from pathlib import Path |
| 4 |
|
| 5 |
|
| 6 |
BASE_DIR = Path(__file__).resolve().parent.parent |
| 7 |
|
| 8 |
DEBUG = True |
| 9 |
|
| 10 |
ADMINS = ( |
| 11 |
# ('Your Name', '[email protected]'), |
| 12 |
) |
| 13 |
|
| 14 |
MANAGERS = ADMINS |
| 15 |
|
| 16 |
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" |
| 17 |
|
| 18 |
DATABASES = { |
| 19 |
"default": { |
| 20 |
"ENGINE": "django.db.backends.sqlite3", # Add 'postgresql_psycopg2', 'postgresql', |
| 21 |
# 'mysql', 'sqlite3' or 'oracle'. |
| 22 |
"NAME": os.environ.get( |
| 23 |
"DATABASE_NAME", os.path.join(BASE_DIR / "db" / "example.db") |
| 24 |
), |
| 25 |
"USER": "", # Not used with sqlite3. |
| 26 |
"PASSWORD": "", # Not used with sqlite3. |
| 27 |
"HOST": "", # Set to empty string for localhost. Not used with sqlite3. |
| 28 |
"PORT": "", # Set to empty string for default. Not used with sqlite3. |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
# Local time zone for this installation. Choices can be found here: |
| 33 |
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
| 34 |
# although not all choices may be available on all operating systems. |
| 35 |
# On Unix systems, a value of None will cause Django to use the same |
| 36 |
# timezone as the operating system. |
| 37 |
# If running in a Windows environment this must be set to the same as your |
| 38 |
# system time zone. |
| 39 |
TIME_ZONE = "America/Chicago" |
| 40 |
|
| 41 |
# Language code for this installation. All choices can be found here: |
| 42 |
# http://www.i18nguy.com/unicode/language-identifiers.html |
| 43 |
LANGUAGE_CODE = "en" |
| 44 |
|
| 45 |
LANGUAGES = [ |
| 46 |
("ar", "Arabic"), |
| 47 |
("az", "Azerbaijani"), |
| 48 |
("bg", "Bulgarian"), |
| 49 |
("ca", "Catalan"), |
| 50 |
("cs", "Czech"), |
| 51 |
("da", "Danish"), |
| 52 |
("de", "German"), |
| 53 |
("el", "Greek"), |
| 54 |
("en", "English"), |
| 55 |
("es", "Spanish"), |
| 56 |
("et", "Estonian"), |
| 57 |
("eu", "Basque"), |
| 58 |
("fa", "Persian"), |
| 59 |
("fi", "Finnish"), |
| 60 |
("fr", "French"), |
| 61 |
("he", "Hebrew"), |
| 62 |
("hr", "Croatian"), |
| 63 |
("hu", "Hungarian"), |
| 64 |
("id", "Indonesian"), |
| 65 |
("it", "Italian"), |
| 66 |
("ja", "Japanese"), |
| 67 |
("ka", "Georgian"), |
| 68 |
("ko", "Korean"), |
| 69 |
("ky", "Kyrgyz"), |
| 70 |
("lt", "Lithuanian"), |
| 71 |
("lv", "Latvian"), |
| 72 |
("mn", "Mongolian"), |
| 73 |
("nb", "Norwegian Bokmål"), |
| 74 |
("nl", "Dutch"), |
| 75 |
("pl", "Polish"), |
| 76 |
("pt-BR", "Portuguese (Brazil)"), |
| 77 |
("pt-PT", "Portuguese (Portugal)"), |
| 78 |
("ro", "Romanian"), |
| 79 |
("ru", "Russian"), |
| 80 |
("sk", "Slovak"), |
| 81 |
("sl", "Slovenian"), |
| 82 |
("sr", "Serbian"), |
| 83 |
("sr-Latn", "Serbian (Latin)"), |
| 84 |
("sv", "Swedish"), |
| 85 |
("th", "Thai"), |
| 86 |
("tr", "Turkish"), |
| 87 |
("uk", "Ukrainian"), |
| 88 |
("zh-hans", "Chinese (Simplified)"), |
| 89 |
("zh-hant", "Chinese (Traditional)"), |
| 90 |
] |
| 91 |
|
| 92 |
SITE_ID = 1 |
| 93 |
|
| 94 |
# If you set this to False, Django will make some optimizations so as not |
| 95 |
# to load the internationalization machinery. |
| 96 |
USE_I18N = True |
| 97 |
|
| 98 |
# If you set this to False, Django will not format dates, numbers and |
| 99 |
# calendars according to the current locale |
| 100 |
USE_L10N = True |
| 101 |
|
| 102 |
# Absolute filesystem path to the directory that will hold user-uploaded files. |
| 103 |
# Example: "/home/media/media.lawrence.com/media/" |
| 104 |
MEDIA_ROOT = "" |
| 105 |
|
| 106 |
# URL that handles the media served from MEDIA_ROOT. Make sure to use a |
| 107 |
# trailing slash. |
| 108 |
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" |
| 109 |
MEDIA_URL = "" |
| 110 |
|
| 111 |
# Absolute path to the directory static files should be collected to. |
| 112 |
# Don't put anything in this directory yourself; store your static files |
| 113 |
# in apps' "static/" subdirectories and in STATICFILES_DIRS. |
| 114 |
# Example: "/home/media/media.lawrence.com/static/" |
| 115 |
STATIC_ROOT = "" |
| 116 |
|
| 117 |
# URL prefix for static files. |
| 118 |
# Example: "http://media.lawrence.com/static/" |
| 119 |
STATIC_URL = "/static/" |
| 120 |
|
| 121 |
# Additional locations of static files |
| 122 |
STATICFILES_DIRS = ( |
| 123 |
# Put strings here, like "/home/html/static" or "C:/www/django/static". |
| 124 |
# Always use forward slashes, even on Windows. |
| 125 |
# Don't forget to use absolute paths, not relative paths. |
| 126 |
) |
| 127 |
|
| 128 |
# List of finder classes that know how to find static files in |
| 129 |
# various locations. |
| 130 |
STATICFILES_FINDERS = ( |
| 131 |
"django.contrib.staticfiles.finders.FileSystemFinder", |
| 132 |
"django.contrib.staticfiles.finders.AppDirectoriesFinder", |
| 133 |
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', |
| 134 |
) |
| 135 |
|
| 136 |
# Make this unique, and don't share it with anybody. |
| 137 |
SECRET_KEY = "t8_)kj3v!au0!_i56#gre**mkg0&z1df%3bw(#5^#^5e_64!$_" |
| 138 |
|
| 139 |
# List of callables that know how to import templates from various sources. |
| 140 |
TEMPLATES = [ |
| 141 |
{ |
| 142 |
"BACKEND": "django.template.backends.django.DjangoTemplates", |
| 143 |
"DIRS": [ |
| 144 |
BASE_DIR / "example" / "templates", |
| 145 |
], |
| 146 |
"APP_DIRS": True, |
| 147 |
"OPTIONS": { |
| 148 |
"context_processors": [ |
| 149 |
"django.template.context_processors.debug", |
| 150 |
"django.template.context_processors.request", |
| 151 |
"django.contrib.auth.context_processors.auth", |
| 152 |
"django.contrib.messages.context_processors.messages", |
| 153 |
], |
| 154 |
}, |
| 155 |
}, |
| 156 |
] |
| 157 |
|
| 158 |
MIDDLEWARE = ( |
| 159 |
"django.contrib.sessions.middleware.SessionMiddleware", |
| 160 |
"django.middleware.common.CommonMiddleware", |
| 161 |
"django.middleware.csrf.CsrfViewMiddleware", |
| 162 |
"django.middleware.locale.LocaleMiddleware", |
| 163 |
"django.contrib.auth.middleware.AuthenticationMiddleware", |
| 164 |
"django.contrib.messages.middleware.MessageMiddleware", |
| 165 |
"allauth.account.middleware.AccountMiddleware", |
| 166 |
) |
| 167 |
|
| 168 |
AUTHENTICATION_BACKENDS = ("allauth.account.auth_backends.AuthenticationBackend",) |
| 169 |
|
| 170 |
ROOT_URLCONF = "example.urls" |
| 171 |
|
| 172 |
INSTALLED_APPS = ( |
| 173 |
"django.contrib.auth", |
| 174 |
"django.contrib.contenttypes", |
| 175 |
"django.contrib.sessions", |
| 176 |
"django.contrib.humanize", |
| 177 |
"django.contrib.sites", |
| 178 |
"django.contrib.messages", |
| 179 |
"django.contrib.staticfiles", |
| 180 |
"django.contrib.admin", |
| 181 |
"allauth", |
| 182 |
"allauth.account", |
| 183 |
"allauth.socialaccount", |
| 184 |
"allauth.mfa", |
| 185 |
"allauth.socialaccount.providers.dropbox", |
| 186 |
"allauth.socialaccount.providers.dingtalk", |
| 187 |
"allauth.socialaccount.providers.facebook", |
| 188 |
"allauth.socialaccount.providers.edx", |
| 189 |
"allauth.socialaccount.providers.evernote", |
| 190 |
"allauth.socialaccount.providers.google", |
| 191 |
"allauth.socialaccount.providers.github", |
| 192 |
"allauth.socialaccount.providers.linkedin_oauth2", |
| 193 |
"allauth.socialaccount.providers.mediawiki", |
| 194 |
"allauth.socialaccount.providers.openid", |
| 195 |
"allauth.socialaccount.providers.openid_connect", |
| 196 |
"allauth.socialaccount.providers.pinterest", |
| 197 |
"allauth.socialaccount.providers.pocket", |
| 198 |
"allauth.socialaccount.providers.reddit", |
| 199 |
"allauth.socialaccount.providers.saml", |
| 200 |
"allauth.socialaccount.providers.shopify", |
| 201 |
"allauth.socialaccount.providers.slack", |
| 202 |
"allauth.socialaccount.providers.snapchat", |
| 203 |
"allauth.socialaccount.providers.soundcloud", |
| 204 |
"allauth.socialaccount.providers.stackexchange", |
| 205 |
"allauth.socialaccount.providers.telegram", |
| 206 |
"allauth.socialaccount.providers.twitch", |
| 207 |
"allauth.socialaccount.providers.twitter", |
| 208 |
"allauth.socialaccount.providers.twitter_oauth2", |
| 209 |
"allauth.socialaccount.providers.vimeo", |
| 210 |
"allauth.socialaccount.providers.vimeo_oauth2", |
| 211 |
"allauth.socialaccount.providers.weibo", |
| 212 |
"allauth.socialaccount.providers.xing", |
| 213 |
"allauth.usersessions", |
| 214 |
"example.users", |
| 215 |
) |
| 216 |
|
| 217 |
|
| 218 |
AUTH_USER_MODEL = "users.User" |
| 219 |
AUTH_PASSWORD_VALIDATORS = [ |
| 220 |
{ |
| 221 |
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", |
| 222 |
"OPTIONS": { |
| 223 |
"min_length": 9, |
| 224 |
}, |
| 225 |
} |
| 226 |
] |
| 227 |
|
| 228 |
ALLOWED_HOSTS = ["127.0.0.1", "localhost"] |
| 229 |
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") |
| 230 |
ACCOUNT_LOGIN_BY_CODE_ENABLED = True |
| 231 |
ACCOUNT_EMAIL_VERIFICATION = "mandatory" |
| 232 |
ACCOUNT_EMAIL_VERIFICATION_BY_CODE_ENABLED = True |
| 233 |
ACCOUNT_LOGIN_METHODS = { |
| 234 |
"email", |
| 235 |
} |
| 236 |
ACCOUNT_PASSWORD_RESET_BY_CODE_ENABLED = True |
| 237 |
ACCOUNT_SIGNUP_FIELDS = ["email*", "password1*", "password2*"] |
| 238 |
ACCOUNT_ADAPTER = "example.users.allauth.AccountAdapter" |
| 239 |
|
| 240 |
|
| 241 |
MFA_SUPPORTED_TYPES = [ |
| 242 |
"webauthn", |
| 243 |
"totp", |
| 244 |
"recovery_codes", |
| 245 |
] |
| 246 |
MFA_PASSKEY_LOGIN_ENABLED = True |
| 247 |
MFA_PASSKEY_SIGNUP_ENABLED = True |
| 248 |
|
| 249 |
try: |
| 250 |
from .local_settings import * # noqa |
| 251 |
except ImportError: |
| 252 |
pass |