Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

settings.py 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import os
  2. from oscar.defaults import * # noqa
  3. # Path helper
  4. location = lambda x: os.path.join(
  5. os.path.dirname(os.path.realpath(__file__)), x)
  6. ALLOWED_HOSTS = ['test', '.oscarcommerce.com']
  7. DATABASES = {
  8. 'default': {
  9. 'ENGINE': os.environ.get('DATABASE_ENGINE',
  10. 'django.db.backends.postgresql'),
  11. 'NAME': os.environ.get('DATABASE_NAME', 'oscar'),
  12. 'USER': os.environ.get('DATABASE_USER', None),
  13. 'PASSWORD': os.environ.get('DATABASE_PASSWORD', None),
  14. }
  15. }
  16. INSTALLED_APPS = [
  17. 'django.contrib.admin',
  18. 'django.contrib.auth',
  19. 'django.contrib.contenttypes',
  20. 'django.contrib.sessions',
  21. 'django.contrib.staticfiles',
  22. 'django.contrib.sites',
  23. 'django.contrib.flatpages',
  24. 'oscar.config.Shop',
  25. 'oscar.apps.analytics.apps.AnalyticsConfig',
  26. 'oscar.apps.checkout.apps.CheckoutConfig',
  27. 'oscar.apps.address.apps.AddressConfig',
  28. 'oscar.apps.shipping.apps.ShippingConfig',
  29. 'oscar.apps.catalogue.apps.CatalogueConfig',
  30. 'oscar.apps.catalogue.reviews.apps.CatalogueReviewsConfig',
  31. 'oscar.apps.communication.apps.CommunicationConfig',
  32. 'oscar.apps.partner.apps.PartnerConfig',
  33. 'oscar.apps.basket.apps.BasketConfig',
  34. 'oscar.apps.payment.apps.PaymentConfig',
  35. 'oscar.apps.offer.apps.OfferConfig',
  36. 'oscar.apps.order.apps.OrderConfig',
  37. 'oscar.apps.customer.apps.CustomerConfig',
  38. 'oscar.apps.search.apps.SearchConfig',
  39. 'oscar.apps.voucher.apps.VoucherConfig',
  40. 'oscar.apps.wishlists.apps.WishlistsConfig',
  41. 'oscar.apps.dashboard.apps.DashboardConfig',
  42. 'oscar.apps.dashboard.reports.apps.ReportsDashboardConfig',
  43. 'oscar.apps.dashboard.users.apps.UsersDashboardConfig',
  44. 'oscar.apps.dashboard.orders.apps.OrdersDashboardConfig',
  45. 'oscar.apps.dashboard.catalogue.apps.CatalogueDashboardConfig',
  46. 'oscar.apps.dashboard.offers.apps.OffersDashboardConfig',
  47. 'oscar.apps.dashboard.partners.apps.PartnersDashboardConfig',
  48. 'oscar.apps.dashboard.pages.apps.PagesDashboardConfig',
  49. 'oscar.apps.dashboard.ranges.apps.RangesDashboardConfig',
  50. 'oscar.apps.dashboard.reviews.apps.ReviewsDashboardConfig',
  51. 'oscar.apps.dashboard.vouchers.apps.VouchersDashboardConfig',
  52. 'oscar.apps.dashboard.communications.apps.CommunicationsDashboardConfig',
  53. 'oscar.apps.dashboard.shipping.apps.ShippingDashboardConfig',
  54. # 3rd-party apps that oscar depends on
  55. 'widget_tweaks',
  56. 'haystack',
  57. 'treebeard',
  58. 'sorl.thumbnail',
  59. 'easy_thumbnails',
  60. 'django_tables2',
  61. # Contains models we need for testing
  62. 'tests._site.model_tests_app',
  63. 'tests._site.myauth',
  64. ]
  65. # Use a custom partner app to test overriding models. I can't find a way of
  66. # doing this on a per-test basis, so I'm using a global change.
  67. partner_app_idx = INSTALLED_APPS.index('oscar.apps.partner.apps.PartnerConfig')
  68. INSTALLED_APPS[partner_app_idx] = 'tests._site.apps.partner.apps.PartnerConfig'
  69. customer_app_idx = INSTALLED_APPS.index('oscar.apps.customer.apps.CustomerConfig')
  70. INSTALLED_APPS[customer_app_idx] = 'tests._site.apps.customer.apps.CustomerConfig'
  71. catalogue_app_idx = INSTALLED_APPS.index('oscar.apps.catalogue.apps.CatalogueConfig')
  72. INSTALLED_APPS[catalogue_app_idx] = 'tests._site.apps.catalogue.apps.CatalogueConfig'
  73. dashboard_app_idx = INSTALLED_APPS.index('oscar.apps.dashboard.apps.DashboardConfig')
  74. INSTALLED_APPS[dashboard_app_idx] = 'tests._site.apps.dashboard.apps.DashboardConfig'
  75. checkout_app_idx = INSTALLED_APPS.index('oscar.apps.checkout.apps.CheckoutConfig')
  76. INSTALLED_APPS[checkout_app_idx] = 'tests._site.apps.checkout.apps.CheckoutConfig'
  77. AUTH_USER_MODEL = 'myauth.User'
  78. TEMPLATES = [
  79. {
  80. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  81. 'DIRS': [
  82. location('_site/templates'),
  83. ],
  84. 'OPTIONS': {
  85. 'loaders': [
  86. ('django.template.loaders.cached.Loader', [
  87. 'django.template.loaders.filesystem.Loader',
  88. 'django.template.loaders.app_directories.Loader',
  89. ]),
  90. ],
  91. 'context_processors': [
  92. 'django.contrib.auth.context_processors.auth',
  93. 'django.template.context_processors.request',
  94. 'django.template.context_processors.debug',
  95. 'django.template.context_processors.i18n',
  96. 'django.template.context_processors.media',
  97. 'django.template.context_processors.static',
  98. 'django.contrib.messages.context_processors.messages',
  99. 'oscar.apps.search.context_processors.search_form',
  100. 'oscar.apps.communication.notifications.context_processors.notifications',
  101. 'oscar.apps.checkout.context_processors.checkout',
  102. 'oscar.core.context_processors.metadata',
  103. ]
  104. }
  105. }
  106. ]
  107. MIDDLEWARE = [
  108. 'django.middleware.common.CommonMiddleware',
  109. 'django.contrib.sessions.middleware.SessionMiddleware',
  110. 'django.middleware.csrf.CsrfViewMiddleware',
  111. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  112. 'django.contrib.messages.middleware.MessageMiddleware',
  113. 'oscar.apps.basket.middleware.BasketMiddleware',
  114. ]
  115. AUTHENTICATION_BACKENDS = (
  116. 'oscar.apps.customer.auth_backends.EmailBackend',
  117. 'django.contrib.auth.backends.ModelBackend',
  118. )
  119. AUTH_PASSWORD_VALIDATORS = [
  120. {
  121. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  122. 'OPTIONS': {
  123. 'min_length': 6,
  124. }
  125. },
  126. {
  127. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  128. },
  129. ]
  130. HAYSTACK_CONNECTIONS = {'default': {'ENGINE': 'haystack.backends.simple_backend.SimpleEngine'}}
  131. PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
  132. ROOT_URLCONF = 'tests._site.urls'
  133. LOGIN_REDIRECT_URL = '/accounts/'
  134. STATIC_URL = '/static/'
  135. MEDIA_URL = '/media/'
  136. PUBLIC_ROOT = location('public')
  137. MEDIA_ROOT = os.path.join(PUBLIC_ROOT, 'media')
  138. DEBUG = False
  139. SITE_ID = 1
  140. USE_TZ = 1
  141. APPEND_SLASH = True
  142. DDF_DEFAULT_DATA_FIXTURE = 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass'
  143. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
  144. LANGUAGE_CODE = 'en-gb'
  145. OSCAR_INITIAL_ORDER_STATUS = 'A'
  146. OSCAR_ORDER_STATUS_PIPELINE = {'A': ('B',), 'B': ()}
  147. OSCAR_INITIAL_LINE_STATUS = 'a'
  148. OSCAR_LINE_STATUS_PIPELINE = {'a': ('b', ), 'b': ()}
  149. SECRET_KEY = 'notverysecret'
  150. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  151. FIXTURE_DIRS = [location('unit/fixtures')]