base.py 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. """
  2. Django settings for temp project.
  3. Generated by 'django-admin startproject' using Django 1.10.5.
  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. import dj_database_url
  10. import os
  11. # Build paths inside the project like this: os.path.join(PROJECT_DIR, ...)
  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. # SECURITY WARNING: keep the secret key used in production secret!
  17. SECRET_KEY = "c6u0-9c!7nilj_ysatsda0(f@e_2mws2f!6m0n^o*4#*q#kzp)"
  18. # SECURITY WARNING: don't run with debug turned on in production!
  19. DEBUG = True
  20. ALLOWED_HOSTS = []
  21. # Uncomment this (and adjust as appropriate) to enable django-debug-toolbar
  22. # INTERNAL_IPS = [
  23. # '127.0.0.1',
  24. # ]
  25. # Application definition
  26. INSTALLED_APPS = [
  27. "bakerydemo.base",
  28. "bakerydemo.blog",
  29. "bakerydemo.breads",
  30. "bakerydemo.locations",
  31. "bakerydemo.recipes",
  32. "bakerydemo.search",
  33. "wagtail.contrib.search_promotions",
  34. "wagtail.contrib.forms",
  35. "wagtail.contrib.redirects",
  36. "wagtail.embeds",
  37. "wagtail.sites",
  38. "wagtail.users",
  39. "wagtail.snippets",
  40. "wagtail.documents",
  41. "wagtail.images",
  42. "wagtail.search",
  43. "wagtail.admin",
  44. "wagtail.api.v2",
  45. "wagtail.locales",
  46. "wagtail.contrib.table_block",
  47. "wagtail.contrib.typed_table_block",
  48. "wagtail.contrib.modeladmin",
  49. "wagtail.contrib.routable_page",
  50. "wagtail.contrib.simple_translation",
  51. "wagtail.contrib.styleguide",
  52. "wagtail",
  53. "rest_framework",
  54. "modelcluster",
  55. "taggit",
  56. "wagtailfontawesomesvg",
  57. "debug_toolbar",
  58. "django_extensions",
  59. "django.contrib.admin",
  60. "django.contrib.auth",
  61. "django.contrib.contenttypes",
  62. "django.contrib.sessions",
  63. "django.contrib.messages",
  64. "django.contrib.staticfiles",
  65. "django.contrib.sitemaps",
  66. ]
  67. MIDDLEWARE = [
  68. "debug_toolbar.middleware.DebugToolbarMiddleware",
  69. "django.middleware.security.SecurityMiddleware",
  70. "django.contrib.sessions.middleware.SessionMiddleware",
  71. "django.middleware.common.CommonMiddleware",
  72. "django.middleware.csrf.CsrfViewMiddleware",
  73. "django.contrib.auth.middleware.AuthenticationMiddleware",
  74. "django.contrib.messages.middleware.MessageMiddleware",
  75. "django.middleware.clickjacking.XFrameOptionsMiddleware",
  76. "wagtail.contrib.redirects.middleware.RedirectMiddleware",
  77. ]
  78. DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
  79. ROOT_URLCONF = "bakerydemo.urls"
  80. TEMPLATES = [
  81. {
  82. "BACKEND": "django.template.backends.django.DjangoTemplates",
  83. "DIRS": [
  84. "bakerydemo/templates",
  85. ],
  86. "APP_DIRS": True,
  87. "OPTIONS": {
  88. "context_processors": [
  89. "django.template.context_processors.debug",
  90. "django.template.context_processors.request",
  91. "django.contrib.auth.context_processors.auth",
  92. "django.contrib.messages.context_processors.messages",
  93. ],
  94. },
  95. },
  96. ]
  97. WSGI_APPLICATION = "bakerydemo.wsgi.application"
  98. # Database
  99. # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  100. if "DATABASE_URL" in os.environ:
  101. DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
  102. else:
  103. DATABASES = {
  104. "default": {
  105. "ENGINE": "django.db.backends.sqlite3",
  106. "NAME": os.path.join(BASE_DIR, "bakerydemodb"),
  107. }
  108. }
  109. # Password validation
  110. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  111. AUTH_PASSWORD_VALIDATORS = [
  112. {
  113. "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
  114. },
  115. {
  116. "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
  117. },
  118. {
  119. "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
  120. },
  121. {
  122. "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
  123. },
  124. ]
  125. # Internationalization
  126. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  127. LANGUAGE_CODE = "en-us"
  128. TIME_ZONE = "UTC"
  129. USE_I18N = True
  130. USE_L10N = True
  131. USE_TZ = True
  132. # Static files (CSS, JavaScript, Images)
  133. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  134. STATICFILES_FINDERS = [
  135. "django.contrib.staticfiles.finders.FileSystemFinder",
  136. "django.contrib.staticfiles.finders.AppDirectoriesFinder",
  137. ]
  138. STATICFILES_DIRS = [
  139. os.path.join(PROJECT_DIR, "static"),
  140. ]
  141. STATIC_ROOT = os.path.join(PROJECT_DIR, "collect_static")
  142. STATIC_URL = "/static/"
  143. MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
  144. MEDIA_URL = "/media/"
  145. # Override in local settings or replace with your own key. Please don't use our demo key in production!
  146. GOOGLE_MAP_API_KEY = "AIzaSyD31CT9P9KxvNUJOwDq2kcFEIG8ADgaFgw"
  147. # Use Elasticsearch as the search backend for extra performance and better search results
  148. WAGTAILSEARCH_BACKENDS = {
  149. "default": {
  150. "BACKEND": "wagtail.search.backends.database",
  151. "INDEX": "bakerydemo",
  152. },
  153. }
  154. # Wagtail settings
  155. WAGTAIL_SITE_NAME = "bakerydemo"
  156. WAGTAIL_I18N_ENABLED = True
  157. WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
  158. ("en", "English"),
  159. ("de", "Deutsch"),
  160. ("ar", "العربيّة"),
  161. ]
  162. ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "changeme")