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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. }
  14. }
  15. INSTALLED_APPS = [
  16. 'django.contrib.auth',
  17. 'django.contrib.admin',
  18. 'django.contrib.contenttypes',
  19. 'django.contrib.sessions',
  20. 'django.contrib.sites',
  21. 'django.contrib.flatpages',
  22. 'django.contrib.staticfiles',
  23. 'widget_tweaks',
  24. # contains models we need for testing
  25. 'tests._site.model_tests_app',
  26. 'tests._site.myauth',
  27. # Use a custom partner app to test overriding models. I can't
  28. # find a way of doing this on a per-test basis, so I'm using a
  29. # global change.
  30. ] + oscar.get_core_apps(['tests._site.apps.partner', 'tests._site.apps.customer'])
  31. AUTH_USER_MODEL = 'myauth.User'
  32. TEMPLATES = [
  33. {
  34. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  35. 'DIRS': [
  36. location('_site/templates'),
  37. oscar.OSCAR_MAIN_TEMPLATE_DIR,
  38. ],
  39. 'OPTIONS': {
  40. 'loaders': [
  41. ('django.template.loaders.cached.Loader', [
  42. 'django.template.loaders.filesystem.Loader',
  43. 'django.template.loaders.app_directories.Loader',
  44. ]),
  45. ],
  46. 'context_processors': [
  47. 'django.contrib.auth.context_processors.auth',
  48. 'django.template.context_processors.request',
  49. 'django.template.context_processors.debug',
  50. 'django.template.context_processors.i18n',
  51. 'django.template.context_processors.media',
  52. 'django.template.context_processors.static',
  53. 'django.contrib.messages.context_processors.messages',
  54. 'oscar.apps.search.context_processors.search_form',
  55. 'oscar.apps.customer.notifications.context_processors.notifications',
  56. 'oscar.apps.promotions.context_processors.promotions',
  57. 'oscar.apps.checkout.context_processors.checkout',
  58. 'oscar.core.context_processors.metadata',
  59. ]
  60. }
  61. }
  62. ]
  63. MIDDLEWARE = [
  64. 'django.middleware.common.CommonMiddleware',
  65. 'django.contrib.sessions.middleware.SessionMiddleware',
  66. 'django.middleware.csrf.CsrfViewMiddleware',
  67. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  68. 'django.contrib.messages.middleware.MessageMiddleware',
  69. 'oscar.apps.basket.middleware.BasketMiddleware',
  70. ]
  71. AUTHENTICATION_BACKENDS = (
  72. 'oscar.apps.customer.auth_backends.EmailBackend',
  73. 'django.contrib.auth.backends.ModelBackend',
  74. )
  75. AUTH_PASSWORD_VALIDATORS = [
  76. {
  77. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  78. 'OPTIONS': {
  79. 'min_length': 6,
  80. }
  81. },
  82. {
  83. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  84. },
  85. ]
  86. HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'}}
  87. PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
  88. ROOT_URLCONF = 'tests._site.urls'
  89. LOGIN_REDIRECT_URL = '/accounts/'
  90. STATIC_URL = '/static/'
  91. DEBUG = False
  92. SITE_ID = 1
  93. USE_TZ = 1
  94. APPEND_SLASH = True
  95. DDF_DEFAULT_DATA_FIXTURE = 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass'
  96. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
  97. LANGUAGE_CODE = 'en-gb'
  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'