|
1 | 1 | """
|
2 | 2 | Django settings for locallibrary project.
|
3 | 3 |
|
4 |
| -Generated by 'django-admin startproject' using Django 4.2.3. |
| 4 | +Generated by 'django-admin startproject' using Django 5.0.2. |
5 | 5 |
|
6 | 6 | For more information on this file, see
|
7 |
| -https://docs.djangoproject.com/en/4.2/topics/settings/ |
| 7 | +https://docs.djangoproject.com/en/5.0/topics/settings/ |
8 | 8 |
|
9 | 9 | For the full list of settings and their values, see
|
10 |
| -https://docs.djangoproject.com/en/4.2/ref/settings/ |
| 10 | +https://docs.djangoproject.com/en/5.0/ref/settings/ |
11 | 11 | """
|
12 | 12 |
|
13 | 13 | from pathlib import Path
|
|
17 | 17 |
|
18 | 18 |
|
19 | 19 | # Add support for env variables from file if defined
|
20 |
| -import os |
21 | 20 | from dotenv import load_dotenv
|
| 21 | +import os |
22 | 22 | env_path = load_dotenv(os.path.join(BASE_DIR, '.env'))
|
23 | 23 | load_dotenv(env_path)
|
24 | 24 |
|
25 | 25 | # Quick-start development settings - unsuitable for production
|
26 |
| -# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ |
| 26 | +# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ |
27 | 27 |
|
28 | 28 | # SECURITY WARNING: keep the secret key used in production secret!
|
29 | 29 | # SECRET_KEY = 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87'
|
30 |
| -SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87') |
| 30 | +SECRET_KEY = os.environ.get( |
| 31 | + 'DJANGO_SECRET_KEY', 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87') |
31 | 32 |
|
32 | 33 | # SECURITY WARNING: don't run with debug turned on in production!
|
33 |
| -#DEBUG = True |
34 |
| -DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'False' |
| 34 | +DEBUG = True |
| 35 | +# DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'False' |
35 | 36 |
|
36 | 37 | # Set hosts to allow any app on Railway and the local testing URL
|
37 |
| -ALLOWED_HOSTS = ['.railway.app','.pythonanywhere.com','127.0.0.1'] |
| 38 | +ALLOWED_HOSTS = ['.railway.app', '.pythonanywhere.com', '127.0.0.1'] |
38 | 39 |
|
39 | 40 | # Set CSRF trusted origins to allow any app on Railway and the local testing URL
|
40 |
| -CSRF_TRUSTED_ORIGINS = ['https://*.railway.app','https://*.pythonanywhere.com'] |
| 41 | +CSRF_TRUSTED_ORIGINS = ['https://*.railway.app', |
| 42 | + 'https://*.pythonanywhere.com'] |
41 | 43 |
|
42 | 44 |
|
43 | 45 | # Application definition
|
|
50 | 52 | 'django.contrib.messages',
|
51 | 53 | 'django.contrib.staticfiles',
|
52 | 54 | # Add our new application
|
53 |
| - 'catalog.apps.CatalogConfig', #This object was created for us in /catalog/apps.py |
| 55 | + 'catalog.apps.CatalogConfig', # This object was created for us in /catalog/apps.py |
54 | 56 | ]
|
55 | 57 |
|
56 | 58 | MIDDLEWARE = [
|
|
86 | 88 |
|
87 | 89 |
|
88 | 90 | # Database
|
89 |
| -# https://docs.djangoproject.com/en/4.2/ref/settings/#databases |
| 91 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases |
90 | 92 |
|
91 | 93 | DATABASES = {
|
92 | 94 | 'default': {
|
|
97 | 99 |
|
98 | 100 |
|
99 | 101 | # Password validation
|
100 |
| -# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators |
| 102 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators |
101 | 103 |
|
102 | 104 | AUTH_PASSWORD_VALIDATORS = [
|
103 | 105 | {
|
|
116 | 118 |
|
117 | 119 |
|
118 | 120 | # Internationalization
|
119 |
| -# https://docs.djangoproject.com/en/4.2/topics/i18n/ |
| 121 | +# https://docs.djangoproject.com/en/5.0/topics/i18n/ |
120 | 122 |
|
121 | 123 | LANGUAGE_CODE = 'en-us'
|
122 | 124 |
|
|
127 | 129 | USE_TZ = True
|
128 | 130 |
|
129 | 131 |
|
130 |
| - |
131 | 132 | # Redirect to home URL after login (Default redirects to /accounts/profile/)
|
132 | 133 | LOGIN_REDIRECT_URL = '/'
|
133 | 134 |
|
134 | 135 | # Add to test email:
|
135 | 136 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
136 | 137 |
|
137 |
| - |
138 |
| - |
139 | 138 | # Update database configuration from $DATABASE_URL environment variable (if defined)
|
140 | 139 | import dj_database_url
|
141 |
| - |
142 | 140 | if 'DATABASE_URL' in os.environ:
|
143 | 141 | DATABASES['default'] = dj_database_url.config(
|
144 | 142 | conn_max_age=500,
|
|
147 | 145 |
|
148 | 146 |
|
149 | 147 | # Static files (CSS, JavaScript, Images)
|
150 |
| -# https://docs.djangoproject.com/en/4.2/howto/static-files/ |
| 148 | +# https://docs.djangoproject.com/en/5.0/howto/static-files/ |
151 | 149 | # The absolute path to the directory where collectstatic will collect static files for deployment.
|
152 |
| -STATIC_ROOT = BASE_DIR / 'staticfiles' #. os.path.join(BASE_DIR, 'staticfiles') |
| 150 | +STATIC_ROOT = BASE_DIR / 'staticfiles' |
153 | 151 | # The URL to use when referring to static files (where they will be served from)
|
154 | 152 | STATIC_URL = '/static/'
|
155 | 153 |
|
|
164 | 162 | }
|
165 | 163 |
|
166 | 164 | # Default primary key field type
|
167 |
| -# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field |
| 165 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field |
168 | 166 |
|
169 | 167 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
0 commit comments