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 6.8KB

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