|
| 1 | +""" |
| 2 | +Django settings for web project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 4.1.2. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/4.1/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/4.1/ref/settings/ |
| 11 | +""" |
| 12 | + |
1 | 13 | import os |
| 14 | +from pathlib import Path |
2 | 15 |
|
3 | | -BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) |
| 16 | +# Build paths inside the project like this: BASE_DIR / 'subdir'. |
| 17 | +BASE_DIR = Path(__file__).resolve().parent.parent |
| 18 | + |
| 19 | + |
| 20 | +# Application definition |
4 | 21 |
|
5 | 22 | INSTALLED_APPS = [ |
6 | 23 | "django.contrib.admin", |
|
23 | 40 | ] |
24 | 41 |
|
25 | 42 | MIDDLEWARE = [ |
| 43 | + "django.middleware.security.SecurityMiddleware", |
26 | 44 | "django.contrib.sessions.middleware.SessionMiddleware", |
27 | 45 | "django.middleware.locale.LocaleMiddleware", |
28 | 46 | "django.middleware.common.CommonMiddleware", |
|
35 | 53 |
|
36 | 54 | ROOT_URLCONF = "web.urls" |
37 | 55 |
|
38 | | -LANGUAGE_CODE = "en" |
39 | | - |
40 | | -TIME_ZONE = "UTC" |
41 | | - |
42 | | -USE_I18N = True |
43 | | - |
44 | | -USE_L10N = True |
45 | | - |
46 | | -USE_TZ = True |
47 | | - |
48 | | -AUTH_USER_MODEL = "users.User" |
49 | | - |
50 | 56 | TEMPLATES = [ |
51 | 57 | { |
52 | 58 | "BACKEND": "django.template.backends.django.DjangoTemplates", |
53 | 59 | "DIRS": [ |
54 | | - os.path.join(BASE_DIR, "templates"), |
| 60 | + BASE_DIR / ".." / "templates", |
55 | 61 | ], |
56 | 62 | "APP_DIRS": True, |
57 | 63 | "OPTIONS": { |
58 | 64 | "context_processors": [ |
59 | | - # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this |
60 | | - # list if you haven't customized them: |
61 | | - "django.contrib.auth.context_processors.auth", |
62 | 65 | "django.template.context_processors.debug", |
63 | | - "django.template.context_processors.i18n", |
64 | | - "django.template.context_processors.media", |
65 | | - "django.template.context_processors.static", |
66 | | - "django.template.context_processors.tz", |
67 | | - "django.contrib.messages.context_processors.messages", |
68 | 66 | "django.template.context_processors.request", |
| 67 | + "django.contrib.auth.context_processors.auth", |
| 68 | + "django.contrib.messages.context_processors.messages", |
69 | 69 | ], |
70 | 70 | }, |
71 | 71 | }, |
72 | 72 | ] |
73 | 73 |
|
74 | | -LOCALE_PATHS = (os.path.join(BASE_DIR, "locale"),) |
| 74 | +WSGI_APPLICATION = "web.wsgi.application" |
| 75 | + |
| 76 | + |
| 77 | +# Password validation |
| 78 | +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators |
| 79 | + |
| 80 | +AUTH_PASSWORD_VALIDATORS = [ |
| 81 | + { |
| 82 | + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", |
| 83 | + }, |
| 84 | + { |
| 85 | + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", |
| 86 | + }, |
| 87 | + { |
| 88 | + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", |
| 89 | + }, |
| 90 | + { |
| 91 | + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", |
| 92 | + }, |
| 93 | +] |
| 94 | + |
| 95 | + |
| 96 | +# Internationalization |
| 97 | +# https://docs.djangoproject.com/en/4.1/topics/i18n/ |
| 98 | + |
| 99 | +LANGUAGE_CODE = "en-us" |
| 100 | + |
| 101 | +TIME_ZONE = "UTC" |
| 102 | + |
| 103 | +USE_I18N = True |
| 104 | + |
| 105 | +USE_TZ = True |
| 106 | + |
| 107 | + |
| 108 | +# Static files (CSS, JavaScript, Images) |
| 109 | +# https://docs.djangoproject.com/en/4.1/howto/static-files/ |
| 110 | + |
| 111 | +STATIC_URL = "static/" |
| 112 | + |
| 113 | +# Default primary key field type |
| 114 | +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field |
| 115 | + |
| 116 | +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" |
| 117 | + |
| 118 | + |
| 119 | +AUTH_USER_MODEL = "users.User" |
| 120 | + |
| 121 | +LOCALE_PATHS = [BASE_DIR / "locale"] |
75 | 122 |
|
76 | 123 | LOGGING = { |
77 | 124 | "version": 1, |
|
80 | 127 | "file": { |
81 | 128 | "level": "WARNING", # 'DEBUG' |
82 | 129 | "class": "logging.FileHandler", |
83 | | - "filename": BASE_DIR + "/debug.log", |
| 130 | + "filename": BASE_DIR / "debug.log", |
84 | 131 | }, |
85 | 132 | }, |
86 | 133 | "loggers": { |
|
92 | 139 | }, |
93 | 140 | } |
94 | 141 |
|
95 | | -DEFAULT_AUTO_FIELD = "django.db.models.AutoField" |
| 142 | +SUBMISSION_URL = os.environ.get("SUBMISSION_URL", "http://127.0.0.1:8000") |
| 143 | +LOGIN_REDIRECT_URL = "/" |
| 144 | +STATIC_URL = "/static/" |
0 commit comments