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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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):
  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.promotions.context_processors.promotions',
  35. 'oscar.apps.checkout.context_processors.checkout',
  36. ),
  37. TEMPLATE_DIRS=(
  38. location('templates'),
  39. OSCAR_MAIN_TEMPLATE_DIR,
  40. ),
  41. MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
  42. 'oscar.apps.basket.middleware.BasketMiddleware',
  43. ),
  44. AUTHENTICATION_BACKENDS=(
  45. 'oscar.apps.customer.auth_backends.Emailbackend',
  46. 'django.contrib.auth.backends.ModelBackend',
  47. ),
  48. HAYSTACK_CONNECTIONS={
  49. 'default': {
  50. 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
  51. }
  52. },
  53. ROOT_URLCONF='tests.site.urls',
  54. LOGIN_REDIRECT_URL='/accounts/',
  55. DEBUG=False,
  56. SITE_ID=1,
  57. APPEND_SLASH=True,
  58. NOSE_ARGS=nose_args,
  59. **OSCAR_SETTINGS
  60. )