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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. )
  71. MIDDLEWARE_CLASSES = (
  72. 'django.middleware.common.CommonMiddleware',
  73. 'django.contrib.sessions.middleware.SessionMiddleware',
  74. 'django.middleware.csrf.CsrfViewMiddleware',
  75. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  76. #'debug_toolbar.middleware.DebugToolbarMiddleware',
  77. 'django.contrib.messages.middleware.MessageMiddleware',
  78. 'django.middleware.transaction.TransactionMiddleware',
  79. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
  80. )
  81. INTERNAL_IPS = ('127.0.0.1',)
  82. ROOT_URLCONF = 'urls'
  83. TEMPLATE_DIRS = (
  84. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  85. # Always use forward slashes, even on Windows.
  86. # Don't forget to use absolute paths, not relative paths.
  87. )
  88. # A sample logging configuration. The only tangible logging
  89. # performed by this configuration is to send an email to
  90. # the site admins on every HTTP 500 error.
  91. # See http://docs.djangoproject.com/en/dev/topics/logging for
  92. # more details on how to customize your logging configuration.
  93. LOGGING = {
  94. 'version': 1,
  95. 'disable_existing_loggers': False,
  96. 'formatters': {
  97. 'verbose': {
  98. 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  99. },
  100. 'simple': {
  101. 'format': '%(levelname)s %(message)s'
  102. },
  103. },
  104. 'handlers': {
  105. 'null': {
  106. 'level':'DEBUG',
  107. 'class':'django.utils.log.NullHandler',
  108. },
  109. 'console':{
  110. 'level':'DEBUG',
  111. 'class':'logging.StreamHandler',
  112. 'formatter': 'verbose'
  113. },
  114. 'file': {
  115. 'level': 'INFO',
  116. 'class': 'logging.FileHandler',
  117. 'filename': '/tmp/oscar.log',
  118. 'formatter': 'verbose'
  119. },
  120. 'mail_admins': {
  121. 'level': 'ERROR',
  122. 'class': 'django.utils.log.AdminEmailHandler',
  123. },
  124. },
  125. 'loggers': {
  126. 'django': {
  127. 'handlers':['null'],
  128. 'propagate': True,
  129. 'level':'INFO',
  130. },
  131. 'django.request': {
  132. 'handlers': ['mail_admins'],
  133. 'level': 'ERROR',
  134. 'propagate': False,
  135. },
  136. 'oscar.checkout': {
  137. 'handlers': ['console', 'file'],
  138. 'propagate': True,
  139. 'level':'INFO',
  140. },
  141. 'django.db.backends': {
  142. 'handlers':['null'],
  143. 'propagate': False,
  144. 'level':'DEBUG',
  145. },
  146. }
  147. }
  148. INSTALLED_APPS = (
  149. 'django.contrib.auth',
  150. 'django.contrib.contenttypes',
  151. 'django.contrib.sessions',
  152. 'django.contrib.sites',
  153. 'django.contrib.messages',
  154. 'django.contrib.admin',
  155. 'django.contrib.flatpages',
  156. # External apps
  157. 'django_extensions',
  158. 'haystack',
  159. #'debug_toolbar',
  160. # Apps from oscar
  161. 'oscar',
  162. 'oscar.apps.analytics',
  163. 'oscar.apps.discount',
  164. 'oscar.apps.order',
  165. 'oscar.apps.checkout',
  166. 'oscar.apps.shipping',
  167. 'oscar.apps.order_management',
  168. 'oscar.apps.product',
  169. 'oscar.apps.basket',
  170. 'oscar.apps.payment',
  171. 'oscar.apps.offer',
  172. 'oscar.apps.address',
  173. 'oscar.apps.stock',
  174. 'oscar.apps.image',
  175. 'oscar.apps.customer',
  176. 'oscar.apps.promotions',
  177. 'oscar.apps.reports',
  178. 'oscar.apps.search',
  179. 'pyzen',
  180. )
  181. LOGIN_REDIRECT_URL = '/shop/accounts/profile/'
  182. APPEND_SLASH = True
  183. from oscar.defaults import *
  184. # Haystack settings
  185. HAYSTACK_SITECONF = 'oscar.search_sites'
  186. HAYSTACK_SEARCH_ENGINE = 'solr'
  187. HAYSTACK_SOLR_URL = 'http://127.0.0.1:8080/solr'
  188. HAYSTACK_INCLUDE_SPELLING = True
  189. # Local overrides
  190. try:
  191. from local_settings import *
  192. except ImportError:
  193. pass