· 9 years ago · Sep 07, 2016, 01:30 AM
1import os
2
3import oscar
4
5
6def location(x):
7 """ Path Helper """
8 return os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
9
10
11# SECURITY WARNING: keep the secret key used in production secret!
12
13# SECURITY WARNING: don't run with debug turned on in production!
14DEBUG = True if os.getenv('DEBUG') == 'true' else False
15
16ALLOWED_HOSTS = []
17
18DATABASES = {
19 'default': {
20 'ENGINE': 'django.db.backends.postgresql_psycopg2',
21 'NAME': os.environ.get('DATABASE_NAME'),
22 'USER': os.environ.get('DATABASE_USER'),
23 'PASSWORD': os.environ.get('DATABASE_PASSWORD'),
24 'HOST': os.environ.get('DATABASE_HOST'),
25 'PORT': os.environ.get('DATABASE_PORT'),
26 }
27}
28
29CACHES = {
30 'default': {
31 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
32 }
33}
34
35
36USE_TZ = True
37TIME_ZONE = 'Asia/Jakarta'
38
39LANGUAGE_CODE = 'id'
40
41SITE_ID = 1
42
43USE_I18N = False
44
45USE_L10N = True
46
47
48MEDIA_URL = '/media/'
49MEDIA_ROOT = location('media')
50
51STATIC_URL = '/static/'
52STATIC_ROOT = location('static')
53STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
54STATICFILES_DIRS = (location('static/'),)
55
56SECRET_KEY = 'x4$jst%*$t8b4p&c#&ag@iy!913o_gkh*vs8twz76m!3m_@mq6'
57
58TEMPLATE_OPTIONS = {
59 'loaders': [
60 'django.template.loaders.filesystem.Loader',
61 'django.template.loaders.app_directories.Loader',
62 'django.template.loaders.eggs.Loader',
63 ],
64 'context_processors': [
65 'django.contrib.auth.context_processors.auth',
66 'django.template.context_processors.request',
67 'django.template.context_processors.debug',
68 'django.template.context_processors.media',
69 'django.template.context_processors.statistic',
70 'django.contrib.messages.context_processors.messages',
71
72 'oscar.apps.search.context_processors.search_form',
73 'oscar.apps.customer.notifications.context_processors.notifications',
74 'oscar.apps.promotions.context_processors.promotions',
75 'oscar.apps.checkout.context_processors.checkout',
76 'oscar.core.context_processors.metadata',
77 ],
78 'debug': DEBUG,
79}
80
81TEMPLATES = [
82 {
83 'BACKEND': 'django.template.backends.django.DjangoTemplates',
84 'DIRS': [
85 location('templates'),
86 oscar.OSCAR_MAIN_TEMPLATE_DIR,
87 ],
88 'OPTIONS': TEMPLATE_OPTIONS,
89 },
90]
91
92MIDDLEWARE_CLASSES = (
93 'django.contrib.sessions.middleware.SessionMiddleware',
94 'django.middleware.common.CommonMiddleware',
95 'django.middleware.csrf.CsrfViewMiddleware',
96 'django.contrib.auth.middleware.AuthenticationMiddleware',
97 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
98 'django.contrib.messages.middleware.MessageMiddleware',
99 'django.middleware.clickjacking.XFrameOptionsMiddleware',
100 'django.middleware.security.SecurityMiddleware',
101 'oscar.apps.basket.middleware.BasketMiddleware',
102 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
103)
104
105
106INSTALLED_APPS = [
107 'django.contrib.admin',
108 'django.contrib.auth',
109 'django.contrib.contenttypes',
110 'django.contrib.sessions',
111 'django.contrib.sites',
112 'django.contrib.messages',
113 'django.contrib.staticfiles',
114 'django.contrib.flatpages',
115
116 # 'compressor',
117 'widget_tweaks',
118] + oscar.get_core_apps()
119
120
121AUTHENTICATION_BACKENDS = (
122 'oscar.apps.customer.auth_backends.EmailBackend',
123 'django.contrib.auth.backends.ModelBackend',
124)
125
126HAYSTACK_CONNECTIONS = {
127 'default': {
128 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
129 },
130}
131
132OSCAR_INITIAL_ORDER_STATUS = 'Pending'
133OSCAR_INITIAL_LINE_STATUS = 'Pending'
134OSCAR_ORDER_STATUS_PIPELINE = {
135 'Pending': ('Being processed', 'Cancelled',),
136 'Being processed': ('Processed', 'Cancelled',),
137 'Cancelled': (),
138}
139OSCAR_SHOP_NAME = 'Etnik'
140
141ROOT_URLCONF = 'etnik.urls'
142
143
144
145WSGI_APPLICATION = 'etnik.wsgi.application'
146
147
148
149
150
151
152# Static files (CSS, JavaScript, Images)
153# https://docs.djangoproject.com/en/1.8/howto/static-files/
154
155
156THUMBNAIL_DEBUG = True
157THUMBNAIL_KEY_PREFIX = 'thumbnail'