diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-02-03 18:28:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-10 23:07:48 +0000 |
commit | b741c9a4b4047439c6c5428e36a72c22a784feda (patch) | |
tree | 8a92b6d9ac5137464b591ffa0e6683f3c7810242 | |
parent | d72f1982ee282a481054326571dd63cceb22415b (diff) | |
download | poky-b741c9a4b4047439c6c5428e36a72c22a784feda.tar.gz |
bitbake: toaster: enable server-side caches and debug-panel
This patch enables the server-side caches for Django using
file cache in /tmp/ directory.
Patch enables django debug panel if available.
(Bitbake rev: 00496fb67fa341477edbf80c5438f0b069871ac6)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index acc20cc11d..7cf905266d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -211,10 +211,25 @@ MIDDLEWARE_CLASSES = ( | |||
211 | 'django.middleware.csrf.CsrfViewMiddleware', | 211 | 'django.middleware.csrf.CsrfViewMiddleware', |
212 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | 212 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
213 | 'django.contrib.messages.middleware.MessageMiddleware', | 213 | 'django.contrib.messages.middleware.MessageMiddleware', |
214 | 'django.middleware.cache.UpdateCacheMiddleware', | ||
215 | 'django.middleware.cache.FetchFromCacheMiddleware', | ||
214 | # Uncomment the next line for simple clickjacking protection: | 216 | # Uncomment the next line for simple clickjacking protection: |
215 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | 217 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
216 | ) | 218 | ) |
217 | 219 | ||
220 | CACHES = { | ||
221 | # 'default': { | ||
222 | # 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | ||
223 | # 'LOCATION': '127.0.0.1:11211', | ||
224 | # }, | ||
225 | 'default': { | ||
226 | 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', | ||
227 | 'LOCATION': '/tmp/django-default-cache', | ||
228 | 'TIMEOUT': 5, | ||
229 | } | ||
230 | } | ||
231 | |||
232 | |||
218 | from os.path import dirname as DN | 233 | from os.path import dirname as DN |
219 | SITE_ROOT=DN(DN(os.path.abspath(__file__))) | 234 | SITE_ROOT=DN(DN(os.path.abspath(__file__))) |
220 | 235 | ||
@@ -252,17 +267,41 @@ INSTALLED_APPS = ( | |||
252 | ) | 267 | ) |
253 | 268 | ||
254 | 269 | ||
270 | INTERNAL_IPS = ['127.0.0.1', '192.168.2.28'] | ||
271 | |||
255 | # Load django-fresh is TOASTER_DEVEL is set, and the module is available | 272 | # Load django-fresh is TOASTER_DEVEL is set, and the module is available |
256 | FRESH_ENABLED = False | 273 | FRESH_ENABLED = False |
257 | if os.environ.get('TOASTER_DEVEL', None) is not None: | 274 | if os.environ.get('TOASTER_DEVEL', None) is not None: |
258 | try: | 275 | try: |
259 | import fresh | 276 | import fresh |
260 | MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ("fresh.middleware.FreshMiddleware",) | 277 | MIDDLEWARE_CLASSES = ("fresh.middleware.FreshMiddleware",) + MIDDLEWARE_CLASSES |
261 | INSTALLED_APPS = INSTALLED_APPS + ('fresh',) | 278 | INSTALLED_APPS = INSTALLED_APPS + ('fresh',) |
262 | FRESH_ENABLED = True | 279 | FRESH_ENABLED = True |
263 | except: | 280 | except: |
264 | pass | 281 | pass |
265 | 282 | ||
283 | DEBUG_PANEL_ENABLED = False | ||
284 | if os.environ.get('TOASTER_DEVEL', None) is not None: | ||
285 | try: | ||
286 | import debug_toolbar, debug_panel | ||
287 | MIDDLEWARE_CLASSES = ('debug_panel.middleware.DebugPanelMiddleware',) + MIDDLEWARE_CLASSES | ||
288 | #MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',) | ||
289 | INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar','debug_panel',) | ||
290 | DEBUG_PANEL_ENABLED = True | ||
291 | |||
292 | # this cache backend will be used by django-debug-panel | ||
293 | CACHES['debug-panel'] = { | ||
294 | 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', | ||
295 | 'LOCATION': '/var/tmp/debug-panel-cache', | ||
296 | 'TIMEOUT': 300, | ||
297 | 'OPTIONS': { | ||
298 | 'MAX_ENTRIES': 200 | ||
299 | } | ||
300 | } | ||
301 | |||
302 | except: | ||
303 | pass | ||
304 | |||
266 | 305 | ||
267 | SOUTH_TESTS_MIGRATE = False | 306 | SOUTH_TESTS_MIGRATE = False |
268 | 307 | ||