base.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. """
  2. Django settings for {{ project_name }} project.
  3. Generated by 'django-admin startproject' using Django {{ django_version }}.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
  8. """
  9. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  10. import os
  11. PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. BASE_DIR = os.path.dirname(PROJECT_DIR)
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/checklist/
  15. # Application definition
  16. INSTALLED_APPS = [
  17. # This project
  18. 'website',
  19. # Wagtail CRX (CodeRed Extensions)
  20. 'wagtailcrx',
  21. 'bootstrap4',
  22. 'modelcluster',
  23. 'taggit',
  24. 'wagtailcache',
  25. 'wagtailseo',
  26. # Wagtail
  27. 'wagtail.contrib.forms',
  28. 'wagtail.contrib.redirects',
  29. 'wagtail.embeds',
  30. 'wagtail.sites',
  31. 'wagtail.users',
  32. 'wagtail.snippets',
  33. 'wagtail.documents',
  34. 'wagtail.images',
  35. 'wagtail.search',
  36. 'wagtail',
  37. 'wagtail.contrib.settings',
  38. 'wagtail.contrib.modeladmin',
  39. 'wagtail.contrib.table_block',
  40. 'wagtail.admin',
  41. # Django
  42. 'django.contrib.admin',
  43. 'django.contrib.auth',
  44. 'django.contrib.contenttypes',
  45. 'django.contrib.sessions',
  46. 'django.contrib.messages',
  47. 'django.contrib.staticfiles',
  48. "django.contrib.sitemaps",
  49. ]
  50. MIDDLEWARE = [
  51. # Save pages to cache. Must be FIRST.
  52. 'wagtailcache.cache.UpdateCacheMiddleware',
  53. # Common functionality
  54. 'django.contrib.sessions.middleware.SessionMiddleware',
  55. 'django.contrib.messages.middleware.MessageMiddleware',
  56. 'django.middleware.common.CommonMiddleware',
  57. # Security
  58. 'django.middleware.csrf.CsrfViewMiddleware',
  59. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  60. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  61. 'django.middleware.security.SecurityMiddleware',
  62. # Error reporting. Uncomment this to receive emails when a 404 is triggered.
  63. #'django.middleware.common.BrokenLinkEmailsMiddleware',
  64. # CMS functionality
  65. 'wagtail.contrib.redirects.middleware.RedirectMiddleware',
  66. # Fetch from cache. Must be LAST.
  67. 'wagtailcache.cache.FetchFromCacheMiddleware',
  68. ]
  69. ROOT_URLCONF = '{{ project_name }}.urls'
  70. TEMPLATES = [
  71. {
  72. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  73. 'APP_DIRS': True,
  74. 'OPTIONS': {
  75. 'context_processors': [
  76. 'django.template.context_processors.debug',
  77. 'django.template.context_processors.request',
  78. 'django.contrib.auth.context_processors.auth',
  79. 'django.contrib.messages.context_processors.messages',
  80. 'wagtail.contrib.settings.context_processors.settings',
  81. ],
  82. },
  83. },
  84. ]
  85. WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
  86. # Database
  87. # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases
  88. DATABASES = {
  89. 'default': {
  90. 'ENGINE': 'django.db.backends.sqlite3',
  91. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  92. }
  93. }
  94. # Password validation
  95. # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators
  96. AUTH_PASSWORD_VALIDATORS = [
  97. {
  98. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  99. },
  100. {
  101. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  102. },
  103. {
  104. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  105. },
  106. {
  107. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  108. },
  109. ]
  110. # Internationalization
  111. # https://docs.djangoproject.com/en/{{ docs_version }}/topics/i18n/
  112. LANGUAGE_CODE = 'en-us'
  113. TIME_ZONE = 'America/New_York'
  114. USE_I18N = False
  115. USE_L10N = True
  116. USE_TZ = True
  117. # Static files (CSS, JavaScript, Images)
  118. # https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/
  119. STATICFILES_FINDERS = [
  120. 'django.contrib.staticfiles.finders.FileSystemFinder',
  121. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  122. ]
  123. STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  124. STATIC_URL = '/static/'
  125. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  126. MEDIA_URL = '/media/'
  127. # Login
  128. LOGIN_URL = 'wagtailadmin_login'
  129. LOGIN_REDIRECT_URL = 'wagtailadmin_home'
  130. # Wagtail settings
  131. WAGTAIL_SITE_NAME = "{{ sitename }}"
  132. WAGTAIL_ENABLE_UPDATE_CHECK = False
  133. WAGTAILSEARCH_BACKENDS = {
  134. 'default': {
  135. 'BACKEND': 'wagtail.search.backends.database',
  136. }
  137. }
  138. # Base URL to use when referring to full URLs within the Wagtail admin backend -
  139. # e.g. in notification emails. Don't include '/admin' or a trailing slash
  140. WAGTAILADMIN_BASE_URL = 'http://{{ domain }}'
  141. # Bootstrap
  142. BOOTSTRAP4 = {
  143. # set to blank since wagtailcrx already loads jquery and bootstrap
  144. 'jquery_url': '',
  145. 'base_url': '',
  146. # remove green highlight on inputs
  147. 'success_css_class': ''
  148. }
  149. # Tags
  150. TAGGIT_CASE_INSENSITIVE = True
  151. # Sets default for primary key IDs
  152. # See https://docs.djangoproject.com/en/{{ docs_version }}/ref/models/fields/#bigautofield
  153. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'