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

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