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.9KB

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