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

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