Procházet zdrojové kódy

auto commit

master
jfinn před 3 měsíci
rodič
revize
25a00c25d9
1 změnil soubory, kde provedl 448 přidání a 0 odebrání
  1. 448
    0
      edan_v1/edan_v1/q_settings2.py

+ 448
- 0
edan_v1/edan_v1/q_settings2.py Zobrazit soubor

@@ -0,0 +1,448 @@
1
+import os
2
+import environ
3
+import oscar
4
+
5
+env = environ.Env()
6
+
7
+
8
+# WSGI_APPLICATION = "sandbox.wsgi.application"
9
+# ASGI_APPLICATION = "sandbox.asgi.application"
10
+
11
+
12
+WSGI_APPLICATION = "edan_v1.wsgi.application"
13
+ASGI_APPLICATION = "edan_v1.asgi.application"
14
+
15
+# Path helper
16
+location = lambda x: os.path.join(
17
+    os.path.dirname(os.path.realpath(__file__)), x)
18
+
19
+DEBUG = env.bool('DEBUG', default=True)
20
+DEBUG = True
21
+ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['localhost', '127.0.0.1'])
22
+
23
+ALLOWED_HOSTS = [*ALLOWED_HOSTS,"dev.edanflor.com"]
24
+CSRF_TRUSTED_ORIGINS =["https://*.edanflor.com"]
25
+EMAIL_SUBJECT_PREFIX = '[Oscar sandbox] '
26
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
27
+
28
+# Use a Sqlite database by default
29
+DATABASES = {
30
+    'default': {
31
+        'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
32
+        'NAME': os.environ.get('DATABASE_NAME', location('db.sqlite')),
33
+        'USER': os.environ.get('DATABASE_USER', None),
34
+        'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
35
+        'HOST': os.environ.get('DATABASE_HOST', None),
36
+        'PORT': os.environ.get('DATABASE_PORT', None),
37
+        'ATOMIC_REQUESTS': True
38
+    }
39
+}
40
+
41
+CACHES = {
42
+    'default': env.cache(default='locmemcache://'),
43
+}
44
+
45
+
46
+# Local time zone for this installation. Choices can be found here:
47
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
48
+# although not all choices may be available on all operating systems.
49
+# On Unix systems, a value of None will cause Django to use the same
50
+# timezone as the operating system.
51
+USE_TZ = True
52
+TIME_ZONE = 'Europe/London'
53
+
54
+TEST_RUNNER = 'django.test.runner.DiscoverRunner'
55
+
56
+# Language code for this installation. All choices can be found here:
57
+# http://www.i18nguy.com/unicode/language-identifiers.html
58
+LANGUAGE_CODE = 'en-gb'
59
+
60
+# Includes all languages that have >50% coverage in Transifex
61
+# Taken from Django's default setting for LANGUAGES
62
+gettext_noop = lambda s: s
63
+LANGUAGES = (
64
+    ('ar', gettext_noop('Arabic')),
65
+    ('ca', gettext_noop('Catalan')),
66
+    ('cs', gettext_noop('Czech')),
67
+    ('da', gettext_noop('Danish')),
68
+    ('de', gettext_noop('German')),
69
+    ('en-gb', gettext_noop('British English')),
70
+    ('el', gettext_noop('Greek')),
71
+    ('es', gettext_noop('Spanish')),
72
+    ('fi', gettext_noop('Finnish')),
73
+    ('fr', gettext_noop('French')),
74
+    ('it', gettext_noop('Italian')),
75
+    ('ko', gettext_noop('Korean')),
76
+    ('nl', gettext_noop('Dutch')),
77
+    ('pl', gettext_noop('Polish')),
78
+    ('pt', gettext_noop('Portuguese')),
79
+    ('pt-br', gettext_noop('Brazilian Portuguese')),
80
+    ('ro', gettext_noop('Romanian')),
81
+    ('ru', gettext_noop('Russian')),
82
+    ('sk', gettext_noop('Slovak')),
83
+    ('uk', gettext_noop('Ukrainian')),
84
+    ('zh-cn', gettext_noop('Simplified Chinese')),
85
+)
86
+
87
+SITE_ID = 1
88
+
89
+# If you set this to False, Django will make some optimizations so as not
90
+# to load the internationalization machinery.
91
+USE_I18N = True
92
+
93
+# If you set this to False, Django will not format dates, numbers and
94
+# calendars according to the current locale
95
+USE_L10N = True
96
+
97
+# Absolute path to the directory that holds media.
98
+# Example: "/home/media/media.lawrence.com/"
99
+MEDIA_ROOT = location("public/media")
100
+
101
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
102
+# trailing slash if there is a path component (optional in other cases).
103
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
104
+MEDIA_URL = '/media/'
105
+
106
+STATIC_URL = '/static/'
107
+STATIC_ROOT = location('public/static')
108
+STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
109
+STATICFILES_DIRS = (
110
+    location('static/'),
111
+)
112
+STATICFILES_FINDERS = (
113
+    'django.contrib.staticfiles.finders.FileSystemFinder',
114
+    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
115
+)
116
+
117
+# Default primary key field type
118
+# https://docs.djangoproject.com/en/dev/ref/settings/#default-auto-field
119
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
120
+
121
+# Make this unique, and don't share it with anybody.
122
+SECRET_KEY = env.str('SECRET_KEY', default='UajFCuyjDKmWHe29neauXzHi9eZoRXr6RMbT5JyAdPiACBP6Cra2')
123
+
124
+TEMPLATES = [
125
+    {
126
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
127
+        'DIRS': [
128
+            location('templates'),
129
+        ],
130
+        'OPTIONS': {
131
+            'loaders': [
132
+                'django.template.loaders.filesystem.Loader',
133
+                'django.template.loaders.app_directories.Loader',
134
+            ],
135
+            'context_processors': [
136
+                'django.contrib.auth.context_processors.auth',
137
+                'django.template.context_processors.request',
138
+                'django.template.context_processors.debug',
139
+                'django.template.context_processors.i18n',
140
+                'django.template.context_processors.media',
141
+                'django.template.context_processors.static',
142
+                'django.contrib.messages.context_processors.messages',
143
+
144
+                # Oscar specific
145
+                'oscar.apps.search.context_processors.search_form',
146
+                'oscar.apps.communication.notifications.context_processors.notifications',
147
+                'oscar.apps.checkout.context_processors.checkout',
148
+                'oscar.core.context_processors.metadata',
149
+            ],
150
+            'debug': DEBUG,
151
+        }
152
+    }
153
+]
154
+
155
+MIDDLEWARE = [
156
+    'debug_toolbar.middleware.DebugToolbarMiddleware',
157
+
158
+    'django.middleware.security.SecurityMiddleware',
159
+    'whitenoise.middleware.WhiteNoiseMiddleware',
160
+
161
+    'django.contrib.sessions.middleware.SessionMiddleware',
162
+    'django.middleware.csrf.CsrfViewMiddleware',
163
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
164
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
165
+    'django.contrib.messages.middleware.MessageMiddleware',
166
+    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
167
+
168
+    # Allow languages to be selected
169
+    'django.middleware.locale.LocaleMiddleware',
170
+    'django.middleware.http.ConditionalGetMiddleware',
171
+    'django.middleware.common.CommonMiddleware',
172
+
173
+    # Ensure a valid basket is added to the request instance for every request
174
+    'oscar.apps.basket.middleware.BasketMiddleware',
175
+]
176
+
177
+# ROOT_URLCONF = 'urls'
178
+ROOT_URLCONF = "edan_v1.urls"
179
+
180
+# A sample logging configuration. The only tangible logging
181
+# performed by this configuration is to send an email to
182
+# the site admins on every HTTP 500 error.
183
+# See http://docs.djangoproject.com/en/dev/topics/logging for
184
+# more details on how to customize your logging configuration.
185
+LOGGING = {
186
+    'version': 1,
187
+    'disable_existing_loggers': True,
188
+    'formatters': {
189
+        'verbose': {
190
+            'format': '%(levelname)s %(asctime)s %(module)s %(message)s',
191
+        },
192
+        'simple': {
193
+            'format': '[%(asctime)s] %(message)s'
194
+        },
195
+    },
196
+    'root': {
197
+        'level': 'DEBUG',
198
+        'handlers': ['console'],
199
+    },
200
+    'handlers': {
201
+        'null': {
202
+            'level': 'DEBUG',
203
+            'class': 'logging.NullHandler',
204
+        },
205
+        'console': {
206
+            'level': 'DEBUG',
207
+            'class': 'logging.StreamHandler',
208
+            'formatter': 'simple'
209
+        },
210
+    },
211
+    'loggers': {
212
+        'oscar': {
213
+            'level': 'DEBUG',
214
+            'propagate': True,
215
+        },
216
+        'oscar.catalogue.import': {
217
+            'handlers': ['console'],
218
+            'level': 'INFO',
219
+            'propagate': False,
220
+        },
221
+        'oscar.alerts': {
222
+            'handlers': ['null'],
223
+            'level': 'INFO',
224
+            'propagate': False,
225
+        },
226
+
227
+        # Django loggers
228
+        'django': {
229
+            'handlers': ['null'],
230
+            'propagate': True,
231
+            'level': 'INFO',
232
+        },
233
+        'django.request': {
234
+            'handlers': ['console'],
235
+            'level': 'ERROR',
236
+            'propagate': True,
237
+        },
238
+        'django.db.backends': {
239
+            'level': 'WARNING',
240
+            'propagate': True,
241
+        },
242
+        'django.security.DisallowedHost': {
243
+            'handlers': ['null'],
244
+            'propagate': False,
245
+        },
246
+
247
+        # Third party
248
+        'raven': {
249
+            'level': 'DEBUG',
250
+            'handlers': ['console'],
251
+            'propagate': False,
252
+        },
253
+        'sorl.thumbnail': {
254
+            'handlers': ['console'],
255
+            'propagate': True,
256
+            'level': 'INFO',
257
+        },
258
+    }
259
+}
260
+
261
+
262
+INSTALLED_APPS = [
263
+    'django.contrib.admin',
264
+    'django.contrib.auth',
265
+    'django.contrib.contenttypes',
266
+    'django.contrib.sessions',
267
+    'django.contrib.messages',
268
+    'django.contrib.staticfiles',
269
+    'django.contrib.sites',
270
+    'django.contrib.flatpages',
271
+
272
+    'oscar.config.Shop',
273
+    'oscar.apps.analytics.apps.AnalyticsConfig',
274
+    'oscar.apps.checkout.apps.CheckoutConfig',
275
+    'oscar.apps.address.apps.AddressConfig',
276
+    'oscar.apps.shipping.apps.ShippingConfig',
277
+    'oscar.apps.catalogue.apps.CatalogueConfig',
278
+    'oscar.apps.catalogue.reviews.apps.CatalogueReviewsConfig',
279
+    'oscar.apps.communication.apps.CommunicationConfig',
280
+    'oscar.apps.partner.apps.PartnerConfig',
281
+    'oscar.apps.basket.apps.BasketConfig',
282
+    'oscar.apps.payment.apps.PaymentConfig',
283
+    'oscar.apps.offer.apps.OfferConfig',
284
+    'oscar.apps.order.apps.OrderConfig',
285
+    'oscar.apps.customer.apps.CustomerConfig',
286
+    'oscar.apps.search.apps.SearchConfig',
287
+    'oscar.apps.voucher.apps.VoucherConfig',
288
+    'oscar.apps.wishlists.apps.WishlistsConfig',
289
+    'oscar.apps.dashboard.apps.DashboardConfig',
290
+    'oscar.apps.dashboard.reports.apps.ReportsDashboardConfig',
291
+    'oscar.apps.dashboard.users.apps.UsersDashboardConfig',
292
+    'oscar.apps.dashboard.orders.apps.OrdersDashboardConfig',
293
+    'oscar.apps.dashboard.catalogue.apps.CatalogueDashboardConfig',
294
+    'oscar.apps.dashboard.offers.apps.OffersDashboardConfig',
295
+    'oscar.apps.dashboard.partners.apps.PartnersDashboardConfig',
296
+    'oscar.apps.dashboard.pages.apps.PagesDashboardConfig',
297
+    'oscar.apps.dashboard.ranges.apps.RangesDashboardConfig',
298
+    'oscar.apps.dashboard.reviews.apps.ReviewsDashboardConfig',
299
+    'oscar.apps.dashboard.vouchers.apps.VouchersDashboardConfig',
300
+    'oscar.apps.dashboard.communications.apps.CommunicationsDashboardConfig',
301
+    'oscar.apps.dashboard.shipping.apps.ShippingDashboardConfig',
302
+
303
+    # 3rd-party apps that Oscar depends on
304
+    'widget_tweaks',
305
+    'haystack',
306
+    'treebeard',
307
+    'sorl.thumbnail',
308
+    'easy_thumbnails',
309
+    'django_tables2',
310
+
311
+    # Django apps that the sandbox depends on
312
+    'django.contrib.sitemaps',
313
+
314
+    # 3rd-party apps that the sandbox depends on
315
+    'django_extensions',
316
+    'debug_toolbar',
317
+    # "san"
318
+]
319
+
320
+# Add Oscar's custom auth backend so users can sign in using their email
321
+# address.
322
+AUTHENTICATION_BACKENDS = (
323
+    'oscar.apps.customer.auth_backends.EmailBackend',
324
+    'django.contrib.auth.backends.ModelBackend',
325
+)
326
+
327
+AUTH_PASSWORD_VALIDATORS = [
328
+    {
329
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
330
+        'OPTIONS': {
331
+            'min_length': 9,
332
+        }
333
+    },
334
+    {
335
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
336
+    },
337
+]
338
+
339
+
340
+
341
+
342
+LOGIN_REDIRECT_URL = '/'
343
+APPEND_SLASH = True
344
+
345
+# ====================
346
+# Messages contrib app
347
+# ====================
348
+
349
+from django.contrib.messages import constants as messages
350
+MESSAGE_TAGS = {
351
+    messages.ERROR: 'danger'
352
+}
353
+
354
+HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
355
+
356
+# Woosh settings
357
+HAYSTACK_CONNECTIONS = {
358
+    'default': {
359
+        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
360
+        'PATH': location('whoosh_index'),
361
+        'INCLUDE_SPELLING': True,
362
+    },
363
+}
364
+
365
+# Here's a sample Haystack config for Solr 6.x (which is recommended)
366
+# HAYSTACK_CONNECTIONS = {
367
+#     'default': {
368
+#         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
369
+#         'URL': 'http://127.0.0.1:8983/solr/sandbox',
370
+#         'ADMIN_URL': 'http://127.0.0.1:8983/solr/admin/cores',
371
+#         'INCLUDE_SPELLING': True,
372
+#     }
373
+# }
374
+
375
+# =============
376
+# Debug Toolbar
377
+# =============
378
+
379
+INTERNAL_IPS = ['127.0.0.1', '::1']
380
+
381
+# ==============
382
+# Oscar settings
383
+# ==============
384
+
385
+from oscar.defaults import *
386
+
387
+# Meta
388
+# ====
389
+
390
+OSCAR_SHOP_TAGLINE = 'Sandbox'
391
+
392
+OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
393
+OSCAR_ALLOW_ANON_CHECKOUT = True
394
+
395
+
396
+# Order processing
397
+# ================
398
+
399
+# Sample order/line status settings. This is quite simplistic. It's like you'll
400
+# want to override the set_status method on the order object to do more
401
+# sophisticated things.
402
+OSCAR_INITIAL_ORDER_STATUS = 'Pending'
403
+OSCAR_INITIAL_LINE_STATUS = 'Pending'
404
+
405
+# This dict defines the new order statuses than an order can move to
406
+OSCAR_ORDER_STATUS_PIPELINE = {
407
+    'Pending': ('Being processed', 'Cancelled',),
408
+    'Being processed': ('Complete', 'Cancelled',),
409
+    'Cancelled': (),
410
+    'Complete': (),
411
+}
412
+
413
+# This dict defines the line statuses that will be set when an order's status
414
+# is changed
415
+OSCAR_ORDER_STATUS_CASCADE = {
416
+    'Being processed': 'Being processed',
417
+    'Cancelled': 'Cancelled',
418
+    'Complete': 'Shipped',
419
+}
420
+
421
+# Sorl
422
+# ====
423
+
424
+THUMBNAIL_DEBUG = DEBUG
425
+THUMBNAIL_KEY_PREFIX = 'oscar-sandbox'
426
+THUMBNAIL_KVSTORE = env(
427
+    'THUMBNAIL_KVSTORE',
428
+    default='sorl.thumbnail.kvstores.cached_db_kvstore.KVStore')
429
+THUMBNAIL_REDIS_URL = env('THUMBNAIL_REDIS_URL', default=None)
430
+
431
+
432
+# Django 1.6 has switched to JSON serializing for security reasons, but it does not
433
+# serialize Models. We should resolve this by extending the
434
+# django/core/serializers/json.Serializer to have the `dumps` function. Also
435
+# in tests/config.py
436
+SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
437
+
438
+# Security
439
+SECURE_SSL_REDIRECT = env.bool('SECURE_SSL_REDIRECT', default=False)
440
+SECURE_HSTS_SECONDS = env.int('SECURE_HSTS_SECONDS', default=0)
441
+SECURE_CONTENT_TYPE_NOSNIFF = True
442
+SECURE_BROWSER_XSS_FILTER = True
443
+
444
+# Try and import local settings which can be used to override any of the above.
445
+try:
446
+    from settings_local import *
447
+except ImportError:
448
+    pass

Načítá se…
Zrušit
Uložit