您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

config.py 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import os
  2. from django.conf import settings, global_settings
  3. if not settings.configured:
  4. from oscar.defaults import *
  5. oscar_settings = dict([(k, v) for k, v in locals().items() if k.startswith('OSCAR_')])
  6. # Helper function to extract absolute path
  7. location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
  8. settings.configure(
  9. DATABASES={
  10. 'default': {
  11. 'ENGINE': 'django.db.backends.sqlite3',
  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. # Oscar apps
  21. 'oscar',
  22. 'oscar.apps.analytics',
  23. 'oscar.apps.discount',
  24. 'oscar.apps.order',
  25. 'oscar.apps.checkout',
  26. 'oscar.apps.shipping',
  27. 'oscar.apps.catalogue',
  28. 'oscar.apps.catalogue.reviews',
  29. 'oscar.apps.basket',
  30. 'oscar.apps.payment',
  31. 'oscar.apps.offer',
  32. 'oscar.apps.address',
  33. 'oscar.apps.partner',
  34. 'oscar.apps.customer',
  35. 'oscar.apps.promotions',
  36. 'oscar.apps.search',
  37. 'oscar.apps.voucher',
  38. 'oscar.apps.dashboard',
  39. 'oscar.apps.dashboard.reports',
  40. 'oscar.apps.dashboard.users',
  41. 'oscar.apps.dashboard.orders'
  42. ],
  43. TEMPLATE_CONTEXT_PROCESSORS=(
  44. "django.contrib.auth.context_processors.auth",
  45. "django.core.context_processors.request",
  46. "django.core.context_processors.debug",
  47. "django.core.context_processors.i18n",
  48. "django.core.context_processors.media",
  49. "django.core.context_processors.static",
  50. "django.contrib.messages.context_processors.messages",
  51. 'oscar.apps.search.context_processors.search_form',
  52. 'oscar.apps.promotions.context_processors.promotions',
  53. 'oscar.apps.checkout.context_processors.checkout',
  54. ),
  55. TEMPLATE_DIRS=(
  56. location('templates'),
  57. ),
  58. MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
  59. 'oscar.apps.basket.middleware.BasketMiddleware',
  60. ),
  61. AUTHENTICATION_BACKENDS=(
  62. 'oscar.apps.customer.auth_backends.Emailbackend',
  63. 'django.contrib.auth.backends.ModelBackend',
  64. ),
  65. ROOT_URLCONF='tests.urls',
  66. LOGIN_REDIRECT_URL='/accounts/',
  67. DEBUG=False,
  68. SITE_ID=1,
  69. HAYSTACK_SEARCH_ENGINE='dummy',
  70. HAYSTACK_SITECONF = 'oscar.search_sites',
  71. APPEND_SLASH=True,
  72. **oscar_settings
  73. )