1
0

settings_base.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. """
  2. Django settings for mysite project.
  3. Generated by 'django-admin startproject' using Django 3.2.19.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/3.2/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/3.2/ref/settings/
  8. """
  9. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  10. import os
  11. from django.utils.translation import gettext_lazy as _
  12. PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  13. BASE_DIR = os.path.dirname(PROJECT_DIR)
  14. # Quick-start development settings - unsuitable for production
  15. # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
  16. # Application definition
  17. INSTALLED_APPS = [
  18. # This project
  19. "website",
  20. # Wagtail CRX (CodeRed Extensions)
  21. "coderedcms",
  22. "django_bootstrap5",
  23. "modelcluster",
  24. "taggit",
  25. "wagtailcache",
  26. "wagtailseo",
  27. # Wagtail
  28. "wagtailmedia",
  29. "wagtail.contrib.routable_page",
  30. "generic_chooser",
  31. "wagtail.contrib.forms",
  32. "wagtail.contrib.redirects",
  33. "wagtail.embeds",
  34. "wagtail.sites",
  35. "wagtail.users",
  36. "wagtail.snippets",
  37. "wagtail.documents",
  38. "wagtail.images",
  39. "wagtail.search",
  40. "wagtail",
  41. "wagtail.contrib.settings",
  42. "wagtail.contrib.modeladmin",
  43. "wagtail.contrib.table_block",
  44. "wagtail.admin",
  45. "wagtailembedpeertube",
  46. "auditlog",
  47. # Django
  48. "django.contrib.admin",
  49. "django.contrib.auth",
  50. "django.contrib.contenttypes",
  51. "django.contrib.sessions",
  52. "django.contrib.messages",
  53. "django.contrib.staticfiles",
  54. "django.contrib.sitemaps",
  55. ]
  56. MIDDLEWARE = [
  57. "auditlog.middleware.AuditlogMiddleware",
  58. # Save pages to cache. Must be FIRST.
  59. "wagtailcache.cache.UpdateCacheMiddleware",
  60. # Common functionality
  61. "django.contrib.sessions.middleware.SessionMiddleware",
  62. "django.contrib.messages.middleware.MessageMiddleware",
  63. "django.middleware.common.CommonMiddleware",
  64. # Security
  65. "django.middleware.csrf.CsrfViewMiddleware",
  66. "django.contrib.auth.middleware.AuthenticationMiddleware",
  67. "django.middleware.clickjacking.XFrameOptionsMiddleware",
  68. "django.middleware.security.SecurityMiddleware",
  69. # Error reporting. Uncomment this to receive emails when a 404 is triggered.
  70. # 'django.middleware.common.BrokenLinkEmailsMiddleware',
  71. # CMS functionality
  72. "wagtail.contrib.redirects.middleware.RedirectMiddleware",
  73. # Fetch from cache. Must be LAST.
  74. "wagtailcache.cache.FetchFromCacheMiddleware",
  75. ]
  76. ROOT_URLCONF = "mysite.urls"
  77. TEMPLATES = [
  78. {
  79. "BACKEND": "django.template.backends.django.DjangoTemplates",
  80. "APP_DIRS": True,
  81. "OPTIONS": {
  82. "context_processors": [
  83. "django.template.context_processors.debug",
  84. "django.template.context_processors.request",
  85. "django.contrib.auth.context_processors.auth",
  86. "django.contrib.messages.context_processors.messages",
  87. "wagtail.contrib.settings.context_processors.settings",
  88. ],
  89. },
  90. },
  91. ]
  92. WSGI_APPLICATION = "mysite.wsgi.application"
  93. # Database
  94. # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  95. DATABASES = {
  96. "default": {
  97. "ENGINE": "django.db.backends.sqlite3",
  98. "NAME": os.path.join(BASE_DIR, "..", ".data", "mysite.sqlite3"),
  99. },
  100. "tweets": {
  101. "ENGINE": "django.db.backends.sqlite3",
  102. "NAME": "c:/users/bob/documents/cityapper/twitter-app/.data/twitter_v2_cache.db",
  103. },
  104. }
  105. DATABASE_ROUTERS = ('website.models.TwitterDatabaseRouter', )
  106. # Password validation
  107. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  108. AUTH_PASSWORD_VALIDATORS = [
  109. {
  110. "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
  111. },
  112. {
  113. "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
  114. },
  115. {
  116. "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
  117. },
  118. {
  119. "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
  120. },
  121. ]
  122. # Internationalization
  123. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  124. # To add or change language of the project, modify the list below.
  125. LANGUAGE_CODE = "en-us"
  126. LANGUAGES = [("en-us", _("English"))]
  127. TIME_ZONE = "America/New_York"
  128. USE_I18N = True
  129. USE_TZ = True
  130. # Static files (CSS, JavaScript, Images)
  131. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  132. STATICFILES_FINDERS = [
  133. "django.contrib.staticfiles.finders.FileSystemFinder",
  134. "django.contrib.staticfiles.finders.AppDirectoriesFinder",
  135. ]
  136. STATIC_ROOT = os.path.join(BASE_DIR, "static")
  137. STATIC_URL = "/static/"
  138. MEDIA_ROOT = os.path.join(BASE_DIR, "..", ".data", "mysite-media")
  139. MEDIA_URL = "/media/"
  140. # Login
  141. LOGIN_URL = "wagtailadmin_login"
  142. LOGIN_REDIRECT_URL = "wagtailadmin_home"
  143. # Wagtail settings
  144. WAGTAIL_SITE_NAME = "Dirt Jolly Bell"
  145. WAGTAIL_ENABLE_UPDATE_CHECK = False
  146. WAGTAILSEARCH_BACKENDS = {
  147. "default": {
  148. "BACKEND": "wagtail.search.backends.database",
  149. }
  150. }
  151. # Base URL to use when referring to full URLs within the Wagtail admin backend -
  152. # e.g. in notification emails. Don't include '/admin' or a trailing slash
  153. WAGTAILADMIN_BASE_URL = "http://dirt-jolly-bell.glitch.me"
  154. # Tags
  155. TAGGIT_CASE_INSENSITIVE = True
  156. # Sets default for primary key IDs
  157. # See https://docs.djangoproject.com/en/3.2/ref/models/fields/#bigautofield
  158. DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
  159. # Media
  160. WAGTAILMEDIA = {
  161. #"MEDIA_MODEL": "", # string, dotted-notation. Defaults to "wagtailmedia.Media"
  162. #"MEDIA_FORM_BASE": "", # string, dotted-notation. Defaults to an empty string
  163. #"AUDIO_EXTENSIONS": [], # list of extensions
  164. #"VIDEO_EXTENSIONS": [], # list of extensions
  165. }
  166. WAGTAILEMBEDS_FINDERS = [
  167. {
  168. "class": "wagtail.embeds.finders.oembed",
  169. },
  170. {
  171. "class": "wagtailembedpeertube.finders",
  172. },
  173. ]
  174. AUDITLOG_INCLUDE_ALL_MODELS=True
  175. #ALLOWED_HOSTS = ['localhost']