Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

settings_simple.py 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  16. 'NAME': 'db.sqlite', # 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. STATIC_URL = '/static/'
  53. STATICFILES_DIRS = (location('static/'),)
  54. STATIC_ROOT = location('public')
  55. # Make this unique, and don't share it with anybody.
  56. SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
  57. # List of callables that know how to import templates from various sources.
  58. TEMPLATE_LOADERS = (
  59. 'django.template.loaders.filesystem.Loader',
  60. 'django.template.loaders.app_directories.Loader',
  61. # 'django.template.loaders.eggs.Loader',
  62. )
  63. TEMPLATE_CONTEXT_PROCESSORS = (
  64. "django.contrib.auth.context_processors.auth",
  65. "django.core.context_processors.request",
  66. "django.core.context_processors.debug",
  67. "django.core.context_processors.i18n",
  68. "django.core.context_processors.media",
  69. "django.core.context_processors.static",
  70. "django.contrib.messages.context_processors.messages",
  71. # Oscar specific
  72. 'oscar.apps.search.context_processors.search_form',
  73. 'oscar.apps.promotions.context_processors.promotions',
  74. 'oscar.apps.checkout.context_processors.checkout',
  75. 'oscar.core.context_processors.metadata',
  76. )
  77. MIDDLEWARE_CLASSES = (
  78. 'django.middleware.common.CommonMiddleware',
  79. 'django.contrib.sessions.middleware.SessionMiddleware',
  80. 'django.middleware.csrf.CsrfViewMiddleware',
  81. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  82. 'django.contrib.messages.middleware.MessageMiddleware',
  83. 'django.middleware.transaction.TransactionMiddleware',
  84. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
  85. 'oscar.apps.basket.middleware.BasketMiddleware',
  86. )
  87. INTERNAL_IPS = ('127.0.0.1',)
  88. ROOT_URLCONF = 'urls'
  89. TEMPLATE_DIRS = (
  90. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  91. # Always use forward slashes, even on Windows.
  92. # Don't forget to use absolute paths, not relative paths.
  93. location('templates')
  94. )
  95. # A sample logging configuration. The only tangible logging
  96. # performed by this configuration is to send an email to
  97. # the site admins on every HTTP 500 error.
  98. # See http://docs.djangoproject.com/en/dev/topics/logging for
  99. # more details on how to customize your logging configuration.
  100. LOGGING = {
  101. 'version': 1,
  102. 'disable_existing_loggers': False,
  103. 'formatters': {
  104. 'verbose': {
  105. 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  106. },
  107. 'simple': {
  108. 'format': '%(levelname)s %(message)s'
  109. },
  110. },
  111. 'handlers': {
  112. 'null': {
  113. 'level':'DEBUG',
  114. 'class':'django.utils.log.NullHandler',
  115. },
  116. 'console':{
  117. 'level':'DEBUG',
  118. 'class':'logging.StreamHandler',
  119. 'formatter': 'verbose'
  120. },
  121. 'file': {
  122. 'level': 'INFO',
  123. 'class': 'logging.FileHandler',
  124. 'filename': '/tmp/oscar.log',
  125. 'formatter': 'verbose'
  126. },
  127. 'mail_admins': {
  128. 'level': 'ERROR',
  129. 'class': 'django.utils.log.AdminEmailHandler',
  130. },
  131. },
  132. 'loggers': {
  133. 'django': {
  134. 'handlers':['null'],
  135. 'propagate': True,
  136. 'level':'INFO',
  137. },
  138. 'django.request': {
  139. 'handlers': ['mail_admins'],
  140. 'level': 'ERROR',
  141. 'propagate': False,
  142. },
  143. 'oscar.checkout': {
  144. 'handlers': ['console', 'file'],
  145. 'propagate': True,
  146. 'level':'INFO',
  147. },
  148. 'django.db.backends': {
  149. 'handlers':['null'],
  150. 'propagate': False,
  151. 'level':'DEBUG',
  152. },
  153. }
  154. }
  155. INSTALLED_APPS = [
  156. 'django.contrib.auth',
  157. 'django.contrib.contenttypes',
  158. 'django.contrib.sessions',
  159. 'django.contrib.sites',
  160. 'django.contrib.messages',
  161. 'django.contrib.admin',
  162. 'django.contrib.flatpages',
  163. 'django.contrib.staticfiles',
  164. # External apps
  165. 'haystack',
  166. 'south',
  167. 'sorl.thumbnail',
  168. ]
  169. from oscar import get_core_apps
  170. INSTALLED_APPS = INSTALLED_APPS + get_core_apps()
  171. AUTHENTICATION_BACKENDS = (
  172. 'oscar.apps.customer.auth_backends.Emailbackend',
  173. 'django.contrib.auth.backends.ModelBackend',
  174. )
  175. LOGIN_REDIRECT_URL = '/accounts/'
  176. APPEND_SLASH = True
  177. # Haystack settings
  178. HAYSTACK_SITECONF = 'oscar.search_sites'
  179. HAYSTACK_SEARCH_ENGINE = 'dummy'
  180. # Oscar settings
  181. from oscar.defaults import *
  182. OSCAR_ALLOW_ANON_CHECKOUT = True
  183. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  184. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  185. OSCAR_ORDER_STATUS_PIPELINE = {
  186. 'Pending': ('Being processed', 'Cancelled',),
  187. 'Being processed': ('Processed', 'Cancelled',),
  188. 'Cancelled': (),
  189. }