base.py 5.1 KB

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