diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /bitbake/lib/toaster/toastermain/settings.py | |
download | poky-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py new file mode 100644 index 0000000000..645f32746d --- /dev/null +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -0,0 +1,231 @@ | |||
1 | # | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # BitBake Toaster Implementation | ||
6 | # | ||
7 | # Copyright (C) 2013 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | |||
22 | # Django settings for Toaster project. | ||
23 | |||
24 | DEBUG = True | ||
25 | TEMPLATE_DEBUG = DEBUG | ||
26 | |||
27 | ADMINS = ( | ||
28 | # ('Your Name', 'your_email@example.com'), | ||
29 | ) | ||
30 | |||
31 | MANAGERS = ADMINS | ||
32 | |||
33 | DATABASES = { | ||
34 | 'default': { | ||
35 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | ||
36 | 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3. | ||
37 | 'USER': '', | ||
38 | 'PASSWORD': '', | ||
39 | 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. | ||
40 | 'PORT': '3306', # Set to empty string for default. | ||
41 | } | ||
42 | } | ||
43 | |||
44 | # Hosts/domain names that are valid for this site; required if DEBUG is False | ||
45 | # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | ||
46 | ALLOWED_HOSTS = [] | ||
47 | |||
48 | # Local time zone for this installation. Choices can be found here: | ||
49 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | ||
50 | # although not all choices may be available on all operating systems. | ||
51 | # In a Windows environment this must be set to your system time zone. | ||
52 | |||
53 | # Always use local computer's time zone, find | ||
54 | import os, hashlib | ||
55 | if 'TZ' in os.environ: | ||
56 | TIME_ZONE = os.environ['TZ'] | ||
57 | else: | ||
58 | # need to read the /etc/localtime file which is the libc standard | ||
59 | # and do a reverse-mapping to /usr/share/zoneinfo/; | ||
60 | # since the timezone may match any number of identical timezone definitions, | ||
61 | |||
62 | zonefilelist = {} | ||
63 | ZONEINFOPATH = '/usr/share/zoneinfo/' | ||
64 | for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): | ||
65 | for fn in filenames: | ||
66 | filepath = os.path.join(dirpath, fn) | ||
67 | zonename = filepath.lstrip(ZONEINFOPATH).strip() | ||
68 | try: | ||
69 | import pytz | ||
70 | from pytz.exceptions import UnknownTimeZoneError | ||
71 | pass | ||
72 | try: | ||
73 | if pytz.timezone(zonename) is not None: | ||
74 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
75 | except UnknownTimeZoneError, ValueError: | ||
76 | # we expect timezone failures here, just move over | ||
77 | pass | ||
78 | except ImportError: | ||
79 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
80 | |||
81 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | ||
82 | |||
83 | # Language code for this installation. All choices can be found here: | ||
84 | # http://www.i18nguy.com/unicode/language-identifiers.html | ||
85 | LANGUAGE_CODE = 'en-us' | ||
86 | |||
87 | SITE_ID = 1 | ||
88 | |||
89 | # If you set this to False, Django will make some optimizations so as not | ||
90 | # to load the internationalization machinery. | ||
91 | USE_I18N = True | ||
92 | |||
93 | # If you set this to False, Django will not format dates, numbers and | ||
94 | # calendars according to the current locale. | ||
95 | USE_L10N = True | ||
96 | |||
97 | # If you set this to False, Django will not use timezone-aware datetimes. | ||
98 | USE_TZ = True | ||
99 | |||
100 | # Absolute filesystem path to the directory that will hold user-uploaded files. | ||
101 | # Example: "/var/www/example.com/media/" | ||
102 | MEDIA_ROOT = '' | ||
103 | |||
104 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | ||
105 | # trailing slash. | ||
106 | # Examples: "http://example.com/media/", "http://media.example.com/" | ||
107 | MEDIA_URL = '' | ||
108 | |||
109 | # Absolute path to the directory static files should be collected to. | ||
110 | # Don't put anything in this directory yourself; store your static files | ||
111 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. | ||
112 | # Example: "/var/www/example.com/static/" | ||
113 | STATIC_ROOT = '' | ||
114 | |||
115 | # URL prefix for static files. | ||
116 | # Example: "http://example.com/static/", "http://static.example.com/" | ||
117 | STATIC_URL = '/static/' | ||
118 | |||
119 | # Additional locations of static files | ||
120 | STATICFILES_DIRS = ( | ||
121 | # Put strings here, like "/home/html/static" or "C:/www/django/static". | ||
122 | # Always use forward slashes, even on Windows. | ||
123 | # Don't forget to use absolute paths, not relative paths. | ||
124 | ) | ||
125 | |||
126 | # List of finder classes that know how to find static files in | ||
127 | # various locations. | ||
128 | STATICFILES_FINDERS = ( | ||
129 | 'django.contrib.staticfiles.finders.FileSystemFinder', | ||
130 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
131 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
132 | ) | ||
133 | |||
134 | # Make this unique, and don't share it with anybody. | ||
135 | SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT' | ||
136 | |||
137 | # List of callables that know how to import templates from various sources. | ||
138 | TEMPLATE_LOADERS = ( | ||
139 | 'django.template.loaders.filesystem.Loader', | ||
140 | 'django.template.loaders.app_directories.Loader', | ||
141 | # 'django.template.loaders.eggs.Loader', | ||
142 | ) | ||
143 | |||
144 | MIDDLEWARE_CLASSES = ( | ||
145 | 'django.middleware.common.CommonMiddleware', | ||
146 | 'django.contrib.sessions.middleware.SessionMiddleware', | ||
147 | 'django.middleware.csrf.CsrfViewMiddleware', | ||
148 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
149 | 'django.contrib.messages.middleware.MessageMiddleware', | ||
150 | # Uncomment the next line for simple clickjacking protection: | ||
151 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
152 | ) | ||
153 | |||
154 | ROOT_URLCONF = 'toastermain.urls' | ||
155 | |||
156 | # Python dotted path to the WSGI application used by Django's runserver. | ||
157 | WSGI_APPLICATION = 'toastermain.wsgi.application' | ||
158 | |||
159 | TEMPLATE_DIRS = ( | ||
160 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
161 | # Always use forward slashes, even on Windows. | ||
162 | # Don't forget to use absolute paths, not relative paths. | ||
163 | ) | ||
164 | |||
165 | TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth', | ||
166 | 'django.core.context_processors.debug', | ||
167 | 'django.core.context_processors.i18n', | ||
168 | 'django.core.context_processors.media', | ||
169 | 'django.core.context_processors.static', | ||
170 | 'django.core.context_processors.tz', | ||
171 | 'django.contrib.messages.context_processors.messages', | ||
172 | "django.core.context_processors.request") | ||
173 | |||
174 | INSTALLED_APPS = ( | ||
175 | #'django.contrib.auth', | ||
176 | #'django.contrib.contenttypes', | ||
177 | #'django.contrib.sessions', | ||
178 | #'django.contrib.sites', | ||
179 | #'django.contrib.messages', | ||
180 | 'django.contrib.staticfiles', | ||
181 | # Uncomment the next line to enable the admin: | ||
182 | # 'django.contrib.admin', | ||
183 | # Uncomment the next line to enable admin documentation: | ||
184 | # 'django.contrib.admindocs', | ||
185 | 'django.contrib.humanize', | ||
186 | 'orm', | ||
187 | 'toastermain', | ||
188 | 'toastergui', | ||
189 | 'bldviewer', | ||
190 | 'south', | ||
191 | ) | ||
192 | |||
193 | # A sample logging configuration. The only tangible logging | ||
194 | # performed by this configuration is to send an email to | ||
195 | # the site admins on every HTTP 500 error when DEBUG=False. | ||
196 | # See http://docs.djangoproject.com/en/dev/topics/logging for | ||
197 | # more details on how to customize your logging configuration. | ||
198 | LOGGING = { | ||
199 | 'version': 1, | ||
200 | 'disable_existing_loggers': False, | ||
201 | 'filters': { | ||
202 | 'require_debug_false': { | ||
203 | '()': 'django.utils.log.RequireDebugFalse' | ||
204 | } | ||
205 | }, | ||
206 | 'handlers': { | ||
207 | 'mail_admins': { | ||
208 | 'level': 'ERROR', | ||
209 | 'filters': ['require_debug_false'], | ||
210 | 'class': 'django.utils.log.AdminEmailHandler' | ||
211 | } | ||
212 | }, | ||
213 | 'loggers': { | ||
214 | 'django.request': { | ||
215 | 'handlers': ['mail_admins'], | ||
216 | 'level': 'ERROR', | ||
217 | 'propagate': True, | ||
218 | }, | ||
219 | } | ||
220 | } | ||
221 | |||
222 | # If we're using sqlite, we need to tweak the performance a bit | ||
223 | from django.db.backends.signals import connection_created | ||
224 | def activate_synchronous_off(sender, connection, **kwargs): | ||
225 | if connection.vendor == 'sqlite': | ||
226 | cursor = connection.cursor() | ||
227 | cursor.execute('PRAGMA synchronous = 0;') | ||
228 | connection_created.connect(activate_synchronous_off) | ||
229 | # | ||
230 | |||
231 | |||