11"""
22Django settings for gettingstarted project.
33
4- Generated by 'django-admin startproject' using Django 4.0 .
4+ Generated by 'django-admin startproject' using Django 4.2.1 .
55
66For more information on this file, see
7- https://docs.djangoproject.com/en/4.0 /topics/settings/
7+ https://docs.djangoproject.com/en/4.2 /topics/settings/
88
99For the full list of settings and their values, see
10- https://docs.djangoproject.com/en/4.0/topics /settings/
10+ https://docs.djangoproject.com/en/4.2/ref /settings/
1111"""
1212
1313import dj_database_url
1414import os
1515from django .test .runner import DiscoverRunner
1616from pathlib import Path
1717
18-
19- # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
18+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
2019BASE_DIR = Path (__file__ ).resolve ().parent .parent
2120
2221
2322IS_HEROKU = "DYNO" in os .environ
2423
2524# Quick-start development settings - unsuitable for production
26- # See https://docs.djangoproject.com/en/4.0 /howto/deployment/checklist/
25+ # See https://docs.djangoproject.com/en/4.2 /howto/deployment/checklist/
2726
2827# SECURITY WARNING: keep the secret key used in production secret!
2928SECRET_KEY = "CHANGE_ME!!!! (P.S. the SECRET_KEY environment variable will be used, if set, instead)."
3029
3130if "SECRET_KEY" in os .environ :
3231 SECRET_KEY = os .environ ["SECRET_KEY" ]
3332
33+ # SECURITY WARNING: don't run with debug turned on in production!
34+ if not IS_HEROKU :
35+ DEBUG = True
3436
3537# Generally avoid wildcards(*). However since Heroku router provides hostname validation it is ok
3638if IS_HEROKU :
3739 ALLOWED_HOSTS = ["*" ]
3840else :
3941 ALLOWED_HOSTS = []
4042
41- # SECURITY WARNING: don't run with debug turned on in production!
42- if not IS_HEROKU :
43- DEBUG = True
4443
4544# Application definition
4645
8786
8887
8988# Database
90- # https://docs.djangoproject.com/en/4.0 /ref/settings/#databases
89+ # https://docs.djangoproject.com/en/4.2 /ref/settings/#databases
9190
9291MAX_CONN_AGE = 600
9392
9493DATABASES = {
9594 "default" : {
9695 "ENGINE" : "django.db.backends.sqlite3" ,
97- "NAME" : os . path . join ( BASE_DIR , "db.sqlite3" ) ,
96+ "NAME" : BASE_DIR / "db.sqlite3" ,
9897 }
9998}
10099
111110
112111
113112# Password validation
114- # https://docs.djangoproject.com/en/4.0 /ref/settings/#auth-password-validators
113+ # https://docs.djangoproject.com/en/4.2 /ref/settings/#auth-password-validators
115114
116115AUTH_PASSWORD_VALIDATORS = [
117116 {
130129
131130
132131# Internationalization
133- # https://docs.djangoproject.com/en/4.0 /topics/i18n/
132+ # https://docs.djangoproject.com/en/4.2 /topics/i18n/
134133
135134LANGUAGE_CODE = "en-us"
136135
142141
143142
144143# Static files (CSS, JavaScript, Images)
145- # https://docs.djangoproject.com/en/4.0 /howto/static-files/
144+ # https://docs.djangoproject.com/en/4.2 /howto/static-files/
146145
147146STATIC_ROOT = BASE_DIR / "staticfiles"
148147STATIC_URL = "static/"
@@ -167,6 +166,6 @@ def setup_databases(self, **kwargs):
167166
168167
169168# Default primary key field type
170- # https://docs.djangoproject.com/en/4.0 /ref/settings/#default-auto-field
169+ # https://docs.djangoproject.com/en/4.2 /ref/settings/#default-auto-field
171170
172171DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
0 commit comments