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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import os
  2. import oscar
  3. from oscar.defaults import * # noqa
  4. # Path helper
  5. location = lambda x: os.path.join(
  6. os.path.dirname(os.path.realpath(__file__)), x)
  7. ALLOWED_HOSTS = ['test', '.oscarcommerce.com']
  8. DATABASES = {
  9. 'default': {
  10. 'ENGINE': os.environ.get('DATABASE_ENGINE',
  11. 'django.db.backends.postgresql'),
  12. 'NAME': os.environ.get('DATABASE_NAME', 'oscar'),
  13. 'USER': os.environ.get('DATABASE_USER', None),
  14. 'PASSWORD': os.environ.get('DATABASE_USER', None),
  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. 'widget_tweaks',
  26. # contains models we need for testing
  27. 'tests._site.model_tests_app',
  28. 'tests._site.myauth',
  29. # Use a custom partner app to test overriding models. I can't
  30. # find a way of doing this on a per-test basis, so I'm using a
  31. # global change.
  32. ] + oscar.get_core_apps([
  33. 'tests._site.apps.partner',
  34. 'tests._site.apps.customer',
  35. 'tests._site.apps.catalogue'
  36. ])
  37. AUTH_USER_MODEL = 'myauth.User'
  38. TEMPLATES = [
  39. {
  40. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  41. 'DIRS': [
  42. location('_site/templates'),
  43. oscar.OSCAR_MAIN_TEMPLATE_DIR,
  44. ],
  45. 'OPTIONS': {
  46. 'loaders': [
  47. ('django.template.loaders.cached.Loader', [
  48. 'django.template.loaders.filesystem.Loader',
  49. 'django.template.loaders.app_directories.Loader',
  50. ]),
  51. ],
  52. 'context_processors': [
  53. 'django.contrib.auth.context_processors.auth',
  54. 'django.template.context_processors.request',
  55. 'django.template.context_processors.debug',
  56. 'django.template.context_processors.i18n',
  57. 'django.template.context_processors.media',
  58. 'django.template.context_processors.static',
  59. 'django.contrib.messages.context_processors.messages',
  60. 'oscar.apps.search.context_processors.search_form',
  61. 'oscar.apps.customer.notifications.context_processors.notifications',
  62. 'oscar.apps.promotions.context_processors.promotions',
  63. 'oscar.apps.checkout.context_processors.checkout',
  64. 'oscar.core.context_processors.metadata',
  65. ]
  66. }
  67. }
  68. ]
  69. MIDDLEWARE = [
  70. 'django.middleware.common.CommonMiddleware',
  71. 'django.contrib.sessions.middleware.SessionMiddleware',
  72. 'django.middleware.csrf.CsrfViewMiddleware',
  73. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  74. 'django.contrib.messages.middleware.MessageMiddleware',
  75. 'oscar.apps.basket.middleware.BasketMiddleware',
  76. ]
  77. AUTHENTICATION_BACKENDS = (
  78. 'oscar.apps.customer.auth_backends.EmailBackend',
  79. 'django.contrib.auth.backends.ModelBackend',
  80. )
  81. AUTH_PASSWORD_VALIDATORS = [
  82. {
  83. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  84. 'OPTIONS': {
  85. 'min_length': 6,
  86. }
  87. },
  88. {
  89. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  90. },
  91. ]
  92. HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'}}
  93. PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
  94. ROOT_URLCONF = 'tests._site.urls'
  95. LOGIN_REDIRECT_URL = '/accounts/'
  96. STATIC_URL = '/static/'
  97. DEBUG = False
  98. SITE_ID = 1
  99. USE_TZ = 1
  100. APPEND_SLASH = True
  101. DDF_DEFAULT_DATA_FIXTURE = 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass'
  102. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
  103. LANGUAGE_CODE = 'en-gb'
  104. OSCAR_INITIAL_ORDER_STATUS = 'A'
  105. OSCAR_ORDER_STATUS_PIPELINE = {'A': ('B',), 'B': ()}
  106. OSCAR_INITIAL_LINE_STATUS = 'a'
  107. OSCAR_LINE_STATUS_PIPELINE = {'a': ('b', ), 'b': ()}
  108. SECRET_KEY = 'notverysecret'
  109. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  110. FIXTURE_DIRS = [location('unit/fixtures')]