You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.py 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import os
  2. from django.conf import settings, global_settings
  3. from oscar import OSCAR_CORE_APPS
  4. if not settings.configured:
  5. from oscar.defaults import *
  6. oscar_settings = dict([(k, v) for k, v in locals().items() if k.startswith('OSCAR_')])
  7. # Helper function to extract absolute path
  8. location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
  9. settings.configure(
  10. DATABASES={
  11. 'default': {
  12. 'ENGINE': 'django.db.backends.sqlite3',
  13. 'NAME': ':memory:',
  14. }
  15. },
  16. INSTALLED_APPS=[
  17. 'django.contrib.auth',
  18. 'django.contrib.admin',
  19. 'django.contrib.contenttypes',
  20. 'django.contrib.sessions',
  21. 'django.contrib.sites',
  22. 'django.contrib.flatpages',
  23. ] + OSCAR_CORE_APPS,
  24. TEMPLATE_CONTEXT_PROCESSORS=(
  25. "django.contrib.auth.context_processors.auth",
  26. "django.core.context_processors.request",
  27. "django.core.context_processors.debug",
  28. "django.core.context_processors.i18n",
  29. "django.core.context_processors.media",
  30. "django.core.context_processors.static",
  31. "django.contrib.messages.context_processors.messages",
  32. 'oscar.apps.search.context_processors.search_form',
  33. 'oscar.apps.promotions.context_processors.promotions',
  34. 'oscar.apps.checkout.context_processors.checkout',
  35. ),
  36. TEMPLATE_DIRS=(
  37. location('templates'),
  38. ),
  39. MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
  40. 'oscar.apps.basket.middleware.BasketMiddleware',
  41. ),
  42. AUTHENTICATION_BACKENDS=(
  43. 'oscar.apps.customer.auth_backends.Emailbackend',
  44. 'django.contrib.auth.backends.ModelBackend',
  45. ),
  46. ROOT_URLCONF='tests.urls',
  47. LOGIN_REDIRECT_URL='/accounts/',
  48. DEBUG=False,
  49. SITE_ID=1,
  50. HAYSTACK_SEARCH_ENGINE='dummy',
  51. HAYSTACK_SITECONF = 'oscar.search_sites',
  52. APPEND_SLASH=True,
  53. **oscar_settings
  54. )