· 7 years ago · Jan 20, 2019, 12:44 PM
1"""
2Django settings for eshop project.
3
4Generated by 'django-admin startproject' using Django 1.11.18.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.11/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.11/ref/settings/
11"""
12
13import os
14from oscar.defaults import *
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24SECRET_KEY = '7_a+!0$e^*2yc@kdgm8lx0spfa&7()zdgon&9^c+%z28^==8x9'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29ALLOWED_HOSTS = []
30
31
32# Application definition
33
34from oscar import get_core_apps
35
36INSTALLED_APPS = [
37 'django.contrib.admin',
38 'django.contrib.auth',
39 'django.contrib.contenttypes',
40 'django.contrib.sessions',
41 'django.contrib.messages',
42 'django.contrib.staticfiles',
43 'django.contrib.sites',
44 'django.contrib.flatpages',
45 'compressor',
46 'widget_tweaks',
47] + get_core_apps()
48
49SITE_ID = 1
50
51MIDDLEWARE = [
52 'django.middleware.security.SecurityMiddleware',
53 'django.contrib.sessions.middleware.SessionMiddleware',
54 'django.middleware.common.CommonMiddleware',
55 'django.middleware.csrf.CsrfViewMiddleware',
56 'django.contrib.auth.middleware.AuthenticationMiddleware',
57 'django.contrib.messages.middleware.MessageMiddleware',
58 'django.middleware.clickjacking.XFrameOptionsMiddleware',
59 'oscar.apps.basket.middleware.BasketMiddleware',
60 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
61]
62
63AUTHENTICATION_BACKENDS = (
64 'oscar.apps.customer.auth_backends.EmailBackend',
65 'django.contrib.auth.backends.ModelBackend',
66)
67
68EMAIL_BACKEND = 'django.core.mail.backends.conso;.EmailBackend'
69
70ROOT_URLCONF = 'eshop.urls'
71
72
73
74from oscar import OSCAR_MAIN_TEMPLATE_DIR
75
76TEMPLATES = [
77 {
78 'BACKEND': 'django.template.backends.django.DjangoTemplates',
79 'DIRS': [
80 os.path.join(BASE_DIR, 'templates'),
81 OSCAR_MAIN_TEMPLATE_DIR
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 'oscar.apps.search.context_processors.search_form',
92 'oscar.apps.promotions.context_processors.promotions',
93 'oscar.apps.checkout.context_processors.checkout',
94 'oscar.apps.customer.notifications.context_processors.notifications',
95 'oscar.core.context_processors.metadata',
96 ],
97 },
98 },
99]
100
101
102WSGI_APPLICATION = 'eshop.wsgi.application'
103
104
105# Database
106# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
107
108DATABASES = {
109 'default': {
110 'ENGINE': 'django.db.backends.sqlite3',
111 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
112 }
113}
114
115HAYSTACK_CONNECTIONS = {
116 'default': {
117 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
118 },
119}
120
121
122# Password validation
123# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
124
125AUTH_PASSWORD_VALIDATORS = [
126 {
127 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
128 },
129 {
130 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
131 },
132 {
133 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
134 },
135 {
136 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
137 },
138]
139
140# Internationalization
141# https://docs.djangoproject.com/en/1.11/topics/i18n/
142
143LANGUAGE_CODE = 'en-us'
144
145TIME_ZONE = 'UTC'
146
147USE_I18N = True
148
149USE_L10N = True
150
151USE_TZ = True
152
153
154# Static files (CSS, JavaScript, Images)
155# https://docs.djangoproject.com/en/1.11/howto/static-files/
156
157STATIC_ROOT = 'static'
158STATIC_URL = '/static/'
159
160MEDIA_ROOT = 'media'
161MEDIA_URL = '/media/'