Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

settings.py 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. ('David', 'david.winterbottom@tangentlabs.co.uk'),
  10. )
  11. EMAIL_SUBJECT_PREFIX = '[Oscar sandbox] '
  12. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  13. MANAGERS = ADMINS
  14. DATABASES = {
  15. 'default': {
  16. 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  17. 'NAME': 'db.sqlite', # Or path to database file if using sqlite3.
  18. 'USER': '', # Not used with sqlite3.
  19. 'PASSWORD': '', # Not used with sqlite3.
  20. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
  21. 'PORT': '', # Set to empty string for default. Not used with sqlite3.
  22. }
  23. }
  24. CACHES = {
  25. 'default': {
  26. 'BACKEND':
  27. 'django.core.cache.backends.memcached.MemcachedCache',
  28. 'LOCATION': '127.0.0.1:11211',
  29. }
  30. }
  31. # Local time zone for this installation. Choices can be found here:
  32. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  33. # although not all choices may be available on all operating systems.
  34. # On Unix systems, a value of None will cause Django to use the same
  35. # timezone as the operating system.
  36. # If running in a Windows environment this must be set to the same as your
  37. # system time zone.
  38. TIME_ZONE = 'Europe/London'
  39. # Language code for this installation. All choices can be found here:
  40. # http://www.i18nguy.com/unicode/language-identifiers.html
  41. LANGUAGE_CODE = 'en-us'
  42. SITE_ID = 1
  43. # If you set this to False, Django will make some optimizations so as not
  44. # to load the internationalization machinery.
  45. USE_I18N = True
  46. # If you set this to False, Django will not format dates, numbers and
  47. # calendars according to the current locale
  48. USE_L10N = True
  49. # Absolute path to the directory that holds media.
  50. # Example: "/home/media/media.lawrence.com/"
  51. MEDIA_ROOT = location("assets/media")
  52. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  53. # trailing slash if there is a path component (optional in other cases).
  54. # Examples: "http://media.lawrence.com", "http://example.com/media/"
  55. MEDIA_URL = '/media/'
  56. # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
  57. # trailing slash.
  58. # Examples: "http://foo.com/media/", "/media/".
  59. #ADMIN_MEDIA_PREFIX = '/media/admin/'
  60. STATIC_URL = '/static/'
  61. STATICFILES_DIRS = ()
  62. STATIC_ROOT = location('public/static')
  63. # Make this unique, and don't share it with anybody.
  64. SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
  65. # List of callables that know how to import templates from various sources.
  66. TEMPLATE_LOADERS = (
  67. 'django.template.loaders.filesystem.Loader',
  68. 'django.template.loaders.app_directories.Loader',
  69. # 'django.template.loaders.eggs.Loader',
  70. )
  71. TEMPLATE_CONTEXT_PROCESSORS = (
  72. "django.contrib.auth.context_processors.auth",
  73. "django.core.context_processors.request",
  74. "django.core.context_processors.debug",
  75. "django.core.context_processors.i18n",
  76. "django.core.context_processors.media",
  77. "django.core.context_processors.static",
  78. "django.contrib.messages.context_processors.messages",
  79. # Oscar specific
  80. 'oscar.apps.search.context_processors.search_form',
  81. 'oscar.apps.promotions.context_processors.promotions',
  82. 'oscar.apps.checkout.context_processors.checkout',
  83. 'oscar.core.context_processors.metadata',
  84. )
  85. MIDDLEWARE_CLASSES = (
  86. 'django.middleware.common.CommonMiddleware',
  87. 'django.contrib.sessions.middleware.SessionMiddleware',
  88. 'django.middleware.csrf.CsrfViewMiddleware',
  89. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  90. 'django.contrib.messages.middleware.MessageMiddleware',
  91. 'django.middleware.transaction.TransactionMiddleware',
  92. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
  93. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  94. 'oscar.apps.basket.middleware.BasketMiddleware',
  95. )
  96. INTERNAL_IPS = ('127.0.0.1',)
  97. ROOT_URLCONF = 'urls'
  98. from oscar import OSCAR_PARENT_TEMPLATE_DIR
  99. TEMPLATE_DIRS = (
  100. location('templates'),
  101. os.path.join(OSCAR_PARENT_TEMPLATE_DIR, 'templates'),
  102. OSCAR_PARENT_TEMPLATE_DIR,
  103. )
  104. # A sample logging configuration. The only tangible logging
  105. # performed by this configuration is to send an email to
  106. # the site admins on every HTTP 500 error.
  107. # See http://docs.djangoproject.com/en/dev/topics/logging for
  108. # more details on how to customize your logging configuration.
  109. LOGGING = {
  110. 'version': 1,
  111. 'disable_existing_loggers': False,
  112. 'formatters': {
  113. 'verbose': {
  114. 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  115. },
  116. 'simple': {
  117. 'format': '%(levelname)s %(message)s'
  118. },
  119. },
  120. 'handlers': {
  121. 'null': {
  122. 'level':'DEBUG',
  123. 'class':'django.utils.log.NullHandler',
  124. },
  125. 'console':{
  126. 'level':'DEBUG',
  127. 'class':'logging.StreamHandler',
  128. 'formatter': 'verbose'
  129. },
  130. 'checkout_file': {
  131. 'level': 'INFO',
  132. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  133. 'filename': 'checkout.log',
  134. 'formatter': 'verbose'
  135. },
  136. 'error_file': {
  137. 'level': 'INFO',
  138. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  139. 'filename': 'errors.log',
  140. 'formatter': 'verbose'
  141. },
  142. 'mail_admins': {
  143. 'level': 'ERROR',
  144. 'class': 'django.utils.log.AdminEmailHandler',
  145. },
  146. },
  147. 'loggers': {
  148. 'django': {
  149. 'handlers':['null'],
  150. 'propagate': True,
  151. 'level':'INFO',
  152. },
  153. 'django.request': {
  154. 'handlers': ['mail_admins', 'error_file'],
  155. 'level': 'ERROR',
  156. 'propagate': False,
  157. },
  158. 'oscar.checkout': {
  159. 'handlers': ['console', 'checkout_file'],
  160. 'propagate': True,
  161. 'level':'INFO',
  162. },
  163. 'django.db.backends': {
  164. 'handlers':['null'],
  165. 'propagate': False,
  166. 'level':'DEBUG',
  167. },
  168. }
  169. }
  170. INSTALLED_APPS = [
  171. 'django.contrib.auth',
  172. 'django.contrib.contenttypes',
  173. 'django.contrib.sessions',
  174. 'django.contrib.sites',
  175. 'django.contrib.messages',
  176. 'django.contrib.admin',
  177. 'django.contrib.flatpages',
  178. 'django.contrib.staticfiles',
  179. # External apps
  180. 'django_extensions',
  181. 'haystack',
  182. 'debug_toolbar',
  183. 'south',
  184. # For profile testing
  185. 'apps.user',
  186. ]
  187. from oscar import get_core_apps
  188. INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps.shipping'])
  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. # Haystack settings
  196. HAYSTACK_SITECONF = 'oscar.search_sites'
  197. HAYSTACK_SEARCH_ENGINE = 'dummy'
  198. DEBUG_TOOLBAR_CONFIG = {
  199. 'INTERCEPT_REDIRECTS': False
  200. }
  201. AUTH_PROFILE_MODULE = 'user.Profile'
  202. # Oscar settings
  203. from oscar.defaults import *
  204. OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
  205. OSCAR_ALLOW_ANON_CHECKOUT = True
  206. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  207. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  208. OSCAR_ORDER_STATUS_PIPELINE = {
  209. 'Pending': ('Being processed', 'Cancelled',),
  210. 'Being processed': ('Processed', 'Cancelled',),
  211. 'Cancelled': (),
  212. }
  213. OSCAR_SHOP_NAME = 'Oscar Sandbox'
  214. OSCAR_SHOP_TAGLINE = 'e-Commerce for Django'
  215. GOOGLE_ANALYTICS_ID = 'UA-XXXXX-Y'
  216. LOG_ROOT = location('logs')
  217. DISPLAY_VERSION = False
  218. THUMBNAIL_DEBUG = True
  219. # Must be within MEDIA_ROOT for sorl to work
  220. OSCAR_MISSING_IMAGE_URL = 'image_not_found.jpg'
  221. try:
  222. from settings_local import *
  223. except ImportError:
  224. pass