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.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import os
  2. from django.conf import settings, global_settings
  3. from oscar import OSCAR_CORE_APPS, OSCAR_MAIN_TEMPLATE_DIR
  4. def configure():
  5. if not settings.configured:
  6. from oscar.defaults import OSCAR_SETTINGS
  7. # Helper function to extract absolute path
  8. location = lambda x: os.path.join(
  9. os.path.dirname(os.path.realpath(__file__)), x)
  10. settings.configure(
  11. DATABASES={
  12. 'default': {
  13. 'ENGINE': 'django.db.backends.sqlite3',
  14. 'NAME': ':memory:',
  15. }
  16. },
  17. INSTALLED_APPS=[
  18. 'django.contrib.auth',
  19. 'django.contrib.admin',
  20. 'django.contrib.contenttypes',
  21. 'django.contrib.sessions',
  22. 'django.contrib.sites',
  23. 'django.contrib.flatpages',
  24. 'django.contrib.staticfiles',
  25. 'sorl.thumbnail',
  26. 'compressor',
  27. ] + OSCAR_CORE_APPS,
  28. TEMPLATE_CONTEXT_PROCESSORS=(
  29. "django.contrib.auth.context_processors.auth",
  30. "django.core.context_processors.request",
  31. "django.core.context_processors.debug",
  32. "django.core.context_processors.i18n",
  33. "django.core.context_processors.media",
  34. "django.core.context_processors.static",
  35. "django.contrib.messages.context_processors.messages",
  36. 'oscar.apps.search.context_processors.search_form',
  37. 'oscar.apps.customer.notifications.context_processors.notifications',
  38. 'oscar.apps.promotions.context_processors.promotions',
  39. 'oscar.apps.checkout.context_processors.checkout',
  40. ),
  41. TEMPLATE_DIRS=(
  42. location('templates'),
  43. OSCAR_MAIN_TEMPLATE_DIR,
  44. ),
  45. MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
  46. 'oscar.apps.basket.middleware.BasketMiddleware',
  47. ),
  48. AUTHENTICATION_BACKENDS=(
  49. 'oscar.apps.customer.auth_backends.Emailbackend',
  50. 'django.contrib.auth.backends.ModelBackend',
  51. ),
  52. HAYSTACK_CONNECTIONS={
  53. 'default': {
  54. 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
  55. }
  56. },
  57. PASSWORD_HASHERS=['django.contrib.auth.hashers.MD5PasswordHasher'],
  58. ROOT_URLCONF='tests._site.urls',
  59. LOGIN_REDIRECT_URL='/accounts/',
  60. STATIC_URL='/static/',
  61. COMPRESS_ENABLED=False,
  62. DEBUG=False,
  63. SITE_ID=1,
  64. APPEND_SLASH=True,
  65. **OSCAR_SETTINGS
  66. )