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.

settings.py 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import os
  2. from django import VERSION as DJANGO_VERSION
  3. import oscar
  4. from oscar.defaults import * # noqa
  5. # Path helper
  6. location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
  7. DATABASES = {
  8. 'default': {
  9. 'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
  10. 'NAME': os.environ.get('DATABASE_NAME', ':memory:'),
  11. },
  12. }
  13. INSTALLED_APPS = [
  14. 'django.contrib.auth',
  15. 'django.contrib.admin',
  16. 'django.contrib.contenttypes',
  17. 'django.contrib.sessions',
  18. 'django.contrib.sites',
  19. 'django.contrib.flatpages',
  20. 'django.contrib.staticfiles',
  21. 'widget_tweaks',
  22. # contains models we need for testing
  23. 'tests._site.model_tests_app',
  24. 'tests._site.myauth',
  25. # Use a custom partner app to test overriding models. I can't
  26. # find a way of doing this on a per-test basis, so I'm using a
  27. # global change.
  28. ] + oscar.get_core_apps(['tests._site.apps.partner', 'tests._site.apps.customer'])
  29. AUTH_USER_MODEL = 'myauth.User'
  30. TEMPLATES = [
  31. {
  32. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  33. 'DIRS': [
  34. location('_site/templates'),
  35. oscar.OSCAR_MAIN_TEMPLATE_DIR,
  36. ],
  37. 'OPTIONS': {
  38. 'loaders': [
  39. ('django.template.loaders.cached.Loader', [
  40. 'django.template.loaders.filesystem.Loader',
  41. 'django.template.loaders.app_directories.Loader',
  42. ]),
  43. ],
  44. 'context_processors': [
  45. 'django.contrib.auth.context_processors.auth',
  46. 'django.template.context_processors.request',
  47. 'django.template.context_processors.debug',
  48. 'django.template.context_processors.i18n',
  49. 'django.template.context_processors.media',
  50. 'django.template.context_processors.static',
  51. 'django.contrib.messages.context_processors.messages',
  52. 'oscar.apps.search.context_processors.search_form',
  53. 'oscar.apps.customer.notifications.context_processors.notifications',
  54. 'oscar.apps.promotions.context_processors.promotions',
  55. 'oscar.apps.checkout.context_processors.checkout',
  56. 'oscar.core.context_processors.metadata',
  57. ]
  58. }
  59. }
  60. ]
  61. if DJANGO_VERSION < (1, 10):
  62. MIDDLEWARE_CLASSES = [
  63. 'django.middleware.common.CommonMiddleware',
  64. 'django.contrib.sessions.middleware.SessionMiddleware',
  65. 'django.middleware.csrf.CsrfViewMiddleware',
  66. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  67. 'django.contrib.messages.middleware.MessageMiddleware',
  68. 'oscar.apps.basket.middleware.BasketMiddleware',
  69. ]
  70. else:
  71. MIDDLEWARE = [
  72. 'django.middleware.common.CommonMiddleware',
  73. 'django.contrib.sessions.middleware.SessionMiddleware',
  74. 'django.middleware.csrf.CsrfViewMiddleware',
  75. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  76. 'django.contrib.messages.middleware.MessageMiddleware',
  77. 'oscar.apps.basket.middleware.BasketMiddleware',
  78. ]
  79. AUTHENTICATION_BACKENDS = (
  80. 'oscar.apps.customer.auth_backends.EmailBackend',
  81. 'django.contrib.auth.backends.ModelBackend',
  82. )
  83. HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'}}
  84. PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
  85. ROOT_URLCONF = 'tests._site.urls'
  86. LOGIN_REDIRECT_URL = '/accounts/'
  87. STATIC_URL = '/static/'
  88. DEBUG = False
  89. SITE_ID = 1
  90. USE_TZ = 1
  91. APPEND_SLASH = True
  92. DDF_DEFAULT_DATA_FIXTURE = 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass'
  93. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
  94. LANGUAGE_CODE = 'en-gb'
  95. # temporary workaround for issue in sorl-thumbnail in Python 3
  96. # https://github.com/mariocesar/sorl-thumbnail/pull/254
  97. THUMBNAIL_DEBUG = False,
  98. OSCAR_INITIAL_ORDER_STATUS = 'A'
  99. OSCAR_ORDER_STATUS_PIPELINE = {'A': ('B',), 'B': ()}
  100. OSCAR_INITIAL_LINE_STATUS = 'a'
  101. OSCAR_LINE_STATUS_PIPELINE = {'a': ('b', ), 'b': ()}
  102. SECRET_KEY = 'notverysecret'
  103. TEST_RUNNER = 'django.test.runner.DiscoverRunner'