Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

settings.py 4.2KB

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