settings.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #
  2. # BitBake Toaster Implementation
  3. #
  4. # Copyright (C) 2013 Intel Corporation
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License version 2 as
  8. # published by the Free Software Foundation.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. # Django settings for Toaster project.
  19. DEBUG = True
  20. TEMPLATE_DEBUG = DEBUG
  21. ADMINS = (
  22. # ('Your Name', 'your_email@example.com'),
  23. )
  24. MANAGERS = ADMINS
  25. DATABASES = {
  26. 'default': {
  27. 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
  28. 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3.
  29. 'USER': '',
  30. 'PASSWORD': '',
  31. 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
  32. 'PORT': '3306', # Set to empty string for default.
  33. }
  34. }
  35. # Hosts/domain names that are valid for this site; required if DEBUG is False
  36. # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
  37. ALLOWED_HOSTS = []
  38. # Local time zone for this installation. Choices can be found here:
  39. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  40. # although not all choices may be available on all operating systems.
  41. # In a Windows environment this must be set to your system time zone.
  42. # Always use local computer's time zone
  43. #TIME_ZONE = ''
  44. # Language code for this installation. All choices can be found here:
  45. # http://www.i18nguy.com/unicode/language-identifiers.html
  46. LANGUAGE_CODE = 'en-us'
  47. SITE_ID = 1
  48. # If you set this to False, Django will make some optimizations so as not
  49. # to load the internationalization machinery.
  50. USE_I18N = True
  51. # If you set this to False, Django will not format dates, numbers and
  52. # calendars according to the current locale.
  53. USE_L10N = True
  54. # If you set this to False, Django will not use timezone-aware datetimes.
  55. USE_TZ = False
  56. # Absolute filesystem path to the directory that will hold user-uploaded files.
  57. # Example: "/var/www/example.com/media/"
  58. MEDIA_ROOT = ''
  59. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  60. # trailing slash.
  61. # Examples: "http://example.com/media/", "http://media.example.com/"
  62. MEDIA_URL = ''
  63. # Absolute path to the directory static files should be collected to.
  64. # Don't put anything in this directory yourself; store your static files
  65. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  66. # Example: "/var/www/example.com/static/"
  67. STATIC_ROOT = ''
  68. # URL prefix for static files.
  69. # Example: "http://example.com/static/", "http://static.example.com/"
  70. STATIC_URL = '/static/'
  71. # Additional locations of static files
  72. STATICFILES_DIRS = (
  73. # Put strings here, like "/home/html/static" or "C:/www/django/static".
  74. # Always use forward slashes, even on Windows.
  75. # Don't forget to use absolute paths, not relative paths.
  76. )
  77. # List of finder classes that know how to find static files in
  78. # various locations.
  79. STATICFILES_FINDERS = (
  80. 'django.contrib.staticfiles.finders.FileSystemFinder',
  81. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  82. # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
  83. )
  84. # Make this unique, and don't share it with anybody.
  85. SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT'
  86. # List of callables that know how to import templates from various sources.
  87. TEMPLATE_LOADERS = (
  88. 'django.template.loaders.filesystem.Loader',
  89. 'django.template.loaders.app_directories.Loader',
  90. # 'django.template.loaders.eggs.Loader',
  91. )
  92. MIDDLEWARE_CLASSES = (
  93. 'django.middleware.common.CommonMiddleware',
  94. 'django.contrib.sessions.middleware.SessionMiddleware',
  95. 'django.middleware.csrf.CsrfViewMiddleware',
  96. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  97. 'django.contrib.messages.middleware.MessageMiddleware',
  98. # Uncomment the next line for simple clickjacking protection:
  99. # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  100. )
  101. ROOT_URLCONF = 'toastermain.urls'
  102. # Python dotted path to the WSGI application used by Django's runserver.
  103. WSGI_APPLICATION = 'toastermain.wsgi.application'
  104. TEMPLATE_DIRS = (
  105. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  106. # Always use forward slashes, even on Windows.
  107. # Don't forget to use absolute paths, not relative paths.
  108. )
  109. INSTALLED_APPS = (
  110. #'django.contrib.auth',
  111. #'django.contrib.contenttypes',
  112. #'django.contrib.sessions',
  113. #'django.contrib.sites',
  114. #'django.contrib.messages',
  115. 'django.contrib.staticfiles',
  116. # Uncomment the next line to enable the admin:
  117. # 'django.contrib.admin',
  118. # Uncomment the next line to enable admin documentation:
  119. # 'django.contrib.admindocs',
  120. 'orm',
  121. 'toastermain',
  122. 'bldviewer',
  123. 'toastergui',
  124. )
  125. # A sample logging configuration. The only tangible logging
  126. # performed by this configuration is to send an email to
  127. # the site admins on every HTTP 500 error when DEBUG=False.
  128. # See http://docs.djangoproject.com/en/dev/topics/logging for
  129. # more details on how to customize your logging configuration.
  130. LOGGING = {
  131. 'version': 1,
  132. 'disable_existing_loggers': False,
  133. 'filters': {
  134. 'require_debug_false': {
  135. '()': 'django.utils.log.RequireDebugFalse'
  136. }
  137. },
  138. 'handlers': {
  139. 'mail_admins': {
  140. 'level': 'ERROR',
  141. 'filters': ['require_debug_false'],
  142. 'class': 'django.utils.log.AdminEmailHandler'
  143. }
  144. },
  145. 'loggers': {
  146. 'django.request': {
  147. 'handlers': ['mail_admins'],
  148. 'level': 'ERROR',
  149. 'propagate': True,
  150. },
  151. }
  152. }
  153. # If we're using sqlite, we need to tweak the performance a bit
  154. from django.db.backends.signals import connection_created
  155. def activate_synchronous_off(sender, connection, **kwargs):
  156. if connection.vendor == 'sqlite':
  157. cursor = connection.cursor()
  158. cursor.execute('PRAGMA synchronous = 0;')
  159. connection_created.connect(activate_synchronous_off)
  160. #