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

settings.py 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. import os
  2. # Django settings for oscar project.
  3. PROJECT_DIR = os.path.dirname(__file__)
  4. location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
  5. DEBUG = True
  6. TEMPLATE_DEBUG = True
  7. SQL_DEBUG = True
  8. ADMINS = (
  9. # ('Your Name', 'your_email@domain.com'),
  10. )
  11. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  12. MANAGERS = ADMINS
  13. DATABASES = {
  14. 'default': {
  15. 'ENGINE': 'django.db.backends.', # Make sure you're using InnoDB
  16. 'NAME': 'oscar_vanilla',
  17. 'USER': '', # Set these details in settings_local.py
  18. 'PASSWORD': '', # "
  19. 'HOST': '',
  20. 'PORT': '',
  21. }
  22. }
  23. CACHES = {
  24. 'default': {
  25. 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
  26. 'LOCATION': '127.0.0.1:11211',
  27. }
  28. }
  29. # Local time zone for this installation. Choices can be found here:
  30. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  31. # although not all choices may be available on all operating systems.
  32. # On Unix systems, a value of None will cause Django to use the same
  33. # timezone as the operating system.
  34. # If running in a Windows environment this must be set to the same as your
  35. # system time zone.
  36. TIME_ZONE = 'Europe/London'
  37. # Language code for this installation. All choices can be found here:
  38. # http://www.i18nguy.com/unicode/language-identifiers.html
  39. LANGUAGE_CODE = 'en-us'
  40. SITE_ID = 1
  41. # If you set this to False, Django will make some optimizations so as not
  42. # to load the internationalization machinery.
  43. USE_I18N = True
  44. # If you set this to False, Django will not format dates, numbers and
  45. # calendars according to the current locale
  46. USE_L10N = True
  47. # Absolute path to the directory that holds media.
  48. # Example: "/home/media/media.lawrence.com/"
  49. MEDIA_ROOT = location("assets")
  50. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  51. # trailing slash if there is a path component (optional in other cases).
  52. # Examples: "http://media.lawrence.com", "http://example.com/media/"
  53. MEDIA_URL = '/media/'
  54. # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
  55. # trailing slash.
  56. # Examples: "http://foo.com/media/", "/media/".
  57. ADMIN_MEDIA_PREFIX = '/media/admin/'
  58. # Make this unique, and don't share it with anybody.
  59. SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
  60. # List of callables that know how to import templates from various sources.
  61. TEMPLATE_LOADERS = (
  62. 'django.template.loaders.filesystem.Loader',
  63. 'django.template.loaders.app_directories.Loader',
  64. # 'django.template.loaders.eggs.Loader',
  65. )
  66. TEMPLATE_CONTEXT_PROCESSORS = (
  67. "django.contrib.auth.context_processors.auth",
  68. "django.core.context_processors.request",
  69. "django.core.context_processors.debug",
  70. "django.core.context_processors.i18n",
  71. "django.core.context_processors.media",
  72. "django.core.context_processors.static",
  73. "django.contrib.messages.context_processors.messages",
  74. # Oscar specific
  75. 'oscar.apps.search.context_processors.search_form',
  76. 'oscar.apps.promotions.context_processors.promotions',
  77. 'oscar.apps.promotions.context_processors.merchandising_blocks',
  78. )
  79. MIDDLEWARE_CLASSES = (
  80. 'django.middleware.common.CommonMiddleware',
  81. 'django.contrib.sessions.middleware.SessionMiddleware',
  82. 'django.middleware.csrf.CsrfViewMiddleware',
  83. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  84. #'debug_toolbar.middleware.DebugToolbarMiddleware',
  85. 'django.contrib.messages.middleware.MessageMiddleware',
  86. 'django.middleware.transaction.TransactionMiddleware',
  87. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
  88. 'oscar.apps.basket.middleware.BasketMiddleware'
  89. )
  90. INTERNAL_IPS = ('127.0.0.1',)
  91. ROOT_URLCONF = 'urls'
  92. TEMPLATE_DIRS = (
  93. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  94. # Always use forward slashes, even on Windows.
  95. # Don't forget to use absolute paths, not relative paths.
  96. )
  97. # A sample logging configuration. The only tangible logging
  98. # performed by this configuration is to send an email to
  99. # the site admins on every HTTP 500 error.
  100. # See http://docs.djangoproject.com/en/dev/topics/logging for
  101. # more details on how to customize your logging configuration.
  102. LOGGING = {
  103. 'version': 1,
  104. 'disable_existing_loggers': False,
  105. 'formatters': {
  106. 'verbose': {
  107. 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  108. },
  109. 'simple': {
  110. 'format': '%(levelname)s %(message)s'
  111. },
  112. },
  113. 'handlers': {
  114. 'null': {
  115. 'level':'DEBUG',
  116. 'class':'django.utils.log.NullHandler',
  117. },
  118. 'console':{
  119. 'level':'DEBUG',
  120. 'class':'logging.StreamHandler',
  121. 'formatter': 'verbose'
  122. },
  123. 'file': {
  124. 'level': 'INFO',
  125. 'class': 'logging.FileHandler',
  126. 'filename': '/tmp/oscar.log',
  127. 'formatter': 'verbose'
  128. },
  129. 'mail_admins': {
  130. 'level': 'ERROR',
  131. 'class': 'django.utils.log.AdminEmailHandler',
  132. },
  133. },
  134. 'loggers': {
  135. 'django': {
  136. 'handlers':['null'],
  137. 'propagate': True,
  138. 'level':'INFO',
  139. },
  140. 'django.request': {
  141. 'handlers': ['mail_admins'],
  142. 'level': 'ERROR',
  143. 'propagate': False,
  144. },
  145. 'oscar.checkout': {
  146. 'handlers': ['console', 'file'],
  147. 'propagate': True,
  148. 'level':'INFO',
  149. },
  150. 'django.db.backends': {
  151. 'handlers':['null'],
  152. 'propagate': False,
  153. 'level':'DEBUG',
  154. },
  155. }
  156. }
  157. INSTALLED_APPS = (
  158. 'django.contrib.auth',
  159. 'django.contrib.contenttypes',
  160. 'django.contrib.sessions',
  161. 'django.contrib.sites',
  162. 'django.contrib.messages',
  163. 'django.contrib.admin',
  164. 'django.contrib.flatpages',
  165. # External apps
  166. 'django_extensions',
  167. 'haystack',
  168. #'debug_toolbar',
  169. # Apps from oscar
  170. 'oscar',
  171. 'oscar.apps.analytics',
  172. 'oscar.apps.discount',
  173. 'oscar.apps.order',
  174. 'oscar.apps.checkout',
  175. 'oscar.apps.shipping',
  176. 'oscar.apps.order_management',
  177. 'oscar.apps.product',
  178. 'oscar.apps.basket',
  179. 'oscar.apps.payment',
  180. 'oscar.apps.offer',
  181. 'oscar.apps.address',
  182. 'oscar.apps.partner',
  183. 'oscar.apps.image',
  184. 'oscar.apps.customer',
  185. 'oscar.apps.promotions',
  186. 'oscar.apps.reports',
  187. 'oscar.apps.search',
  188. 'oscar.apps.product.reviews',
  189. 'oscar.apps.payment.datacash',
  190. 'pyzen',
  191. 'sorl.thumbnail',
  192. )
  193. LOGIN_REDIRECT_URL = '/shop/accounts/profile/'
  194. APPEND_SLASH = True
  195. # Oscar settings
  196. from oscar.defaults import *
  197. # Haystack settings
  198. HAYSTACK_SITECONF = 'oscar.search_sites'
  199. HAYSTACK_SEARCH_ENGINE = 'solr'
  200. HAYSTACK_SOLR_URL = 'http://127.0.0.1:8080/solr'
  201. HAYSTACK_INCLUDE_SPELLING = True
  202. # Local overrides
  203. try:
  204. from settings_local import *
  205. except ImportError:
  206. pass