2
0

base.py 5.0 KB

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