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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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(nose_args=None):
  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(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. 'sorl.thumbnail',
  24. ] + OSCAR_CORE_APPS,
  25. TEMPLATE_CONTEXT_PROCESSORS=(
  26. "django.contrib.auth.context_processors.auth",
  27. "django.core.context_processors.request",
  28. "django.core.context_processors.debug",
  29. "django.core.context_processors.i18n",
  30. "django.core.context_processors.media",
  31. "django.core.context_processors.static",
  32. "django.contrib.messages.context_processors.messages",
  33. 'oscar.apps.search.context_processors.search_form',
  34. 'oscar.apps.customer.notifications.context_processors.notifications',
  35. 'oscar.apps.promotions.context_processors.promotions',
  36. 'oscar.apps.checkout.context_processors.checkout',
  37. ),
  38. TEMPLATE_DIRS=(
  39. location('templates'),
  40. OSCAR_MAIN_TEMPLATE_DIR,
  41. ),
  42. MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
  43. 'oscar.apps.basket.middleware.BasketMiddleware',
  44. ),
  45. AUTHENTICATION_BACKENDS=(
  46. 'oscar.apps.customer.auth_backends.Emailbackend',
  47. 'django.contrib.auth.backends.ModelBackend',
  48. ),
  49. HAYSTACK_CONNECTIONS={
  50. 'default': {
  51. 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
  52. }
  53. },
  54. ROOT_URLCONF='tests.site.urls',
  55. LOGIN_REDIRECT_URL='/accounts/',
  56. DEBUG=False,
  57. SITE_ID=1,
  58. APPEND_SLASH=True,
  59. NOSE_ARGS=nose_args,
  60. **OSCAR_SETTINGS
  61. )