Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

settings.py 7.2KB

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