diff options
Diffstat (limited to 'bitbake/lib/toaster/toastermain')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 27 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastermain/urls.py | 10 |
2 files changed, 32 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 0974b90525..acc20cc11d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -21,11 +21,15 @@ | |||
21 | 21 | ||
22 | # Django settings for Toaster project. | 22 | # Django settings for Toaster project. |
23 | 23 | ||
24 | import os, re | ||
25 | |||
24 | DEBUG = True | 26 | DEBUG = True |
25 | TEMPLATE_DEBUG = DEBUG | 27 | TEMPLATE_DEBUG = DEBUG |
26 | 28 | ||
27 | # Set to True to see the SQL queries in console | 29 | # Set to True to see the SQL queries in console |
28 | SQL_DEBUG = False | 30 | SQL_DEBUG = False |
31 | if os.environ.get("TOASTER_SQLDEBUG", None) is not None: | ||
32 | SQL_DEBUG = True | ||
29 | 33 | ||
30 | 34 | ||
31 | ADMINS = ( | 35 | ADMINS = ( |
@@ -46,7 +50,6 @@ DATABASES = { | |||
46 | } | 50 | } |
47 | 51 | ||
48 | # Reinterpret database settings if we have DATABASE_URL environment variable defined | 52 | # Reinterpret database settings if we have DATABASE_URL environment variable defined |
49 | import os, re | ||
50 | 53 | ||
51 | if 'DATABASE_URL' in os.environ: | 54 | if 'DATABASE_URL' in os.environ: |
52 | dburl = os.environ['DATABASE_URL'] | 55 | dburl = os.environ['DATABASE_URL'] |
@@ -212,6 +215,9 @@ MIDDLEWARE_CLASSES = ( | |||
212 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | 215 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
213 | ) | 216 | ) |
214 | 217 | ||
218 | from os.path import dirname as DN | ||
219 | SITE_ROOT=DN(DN(os.path.abspath(__file__))) | ||
220 | |||
215 | ROOT_URLCONF = 'toastermain.urls' | 221 | ROOT_URLCONF = 'toastermain.urls' |
216 | 222 | ||
217 | # Python dotted path to the WSGI application used by Django's runserver. | 223 | # Python dotted path to the WSGI application used by Django's runserver. |
@@ -245,6 +251,19 @@ INSTALLED_APPS = ( | |||
245 | 'south', | 251 | 'south', |
246 | ) | 252 | ) |
247 | 253 | ||
254 | |||
255 | # Load django-fresh is TOASTER_DEVEL is set, and the module is available | ||
256 | FRESH_ENABLED = False | ||
257 | if os.environ.get('TOASTER_DEVEL', None) is not None: | ||
258 | try: | ||
259 | import fresh | ||
260 | MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ("fresh.middleware.FreshMiddleware",) | ||
261 | INSTALLED_APPS = INSTALLED_APPS + ('fresh',) | ||
262 | FRESH_ENABLED = True | ||
263 | except: | ||
264 | pass | ||
265 | |||
266 | |||
248 | SOUTH_TESTS_MIGRATE = False | 267 | SOUTH_TESTS_MIGRATE = False |
249 | 268 | ||
250 | # if we run in managed mode, we need user support | 269 | # if we run in managed mode, we need user support |
@@ -286,7 +305,7 @@ LOGGING = { | |||
286 | }, | 305 | }, |
287 | 'formatters': { | 306 | 'formatters': { |
288 | 'datetime': { | 307 | 'datetime': { |
289 | 'format': 'DB %(asctime)s %(message)s' | 308 | 'format': '%(levelname)s %(asctime)s %(message)s' |
290 | } | 309 | } |
291 | }, | 310 | }, |
292 | 'handlers': { | 311 | 'handlers': { |
@@ -302,6 +321,10 @@ LOGGING = { | |||
302 | } | 321 | } |
303 | }, | 322 | }, |
304 | 'loggers': { | 323 | 'loggers': { |
324 | 'toaster' : { | ||
325 | 'handlers': ['console'], | ||
326 | 'level': 'DEBUG', | ||
327 | }, | ||
305 | 'django.request': { | 328 | 'django.request': { |
306 | 'handlers': ['mail_admins'], | 329 | 'handlers': ['mail_admins'], |
307 | 'level': 'ERROR', | 330 | 'level': 'ERROR', |
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py index 549fda12d6..a2916e2dd7 100644 --- a/bitbake/lib/toaster/toastermain/urls.py +++ b/bitbake/lib/toaster/toastermain/urls.py | |||
@@ -44,11 +44,15 @@ urlpatterns = patterns('', | |||
44 | ) | 44 | ) |
45 | 45 | ||
46 | import toastermain.settings | 46 | import toastermain.settings |
47 | |||
48 | if toastermain.settings.FRESH_ENABLED: | ||
49 | urlpatterns.insert(1, url(r'', include('fresh.urls'))) | ||
50 | |||
47 | if toastermain.settings.MANAGED: | 51 | if toastermain.settings.MANAGED: |
48 | urlpatterns = urlpatterns + [ | 52 | urlpatterns = [ |
49 | # Uncomment the next line to enable the admin: | 53 | # Uncomment the next line to enable the admin: |
50 | url(r'^admin/', include(admin.site.urls)), | 54 | url(r'^admin/', include(admin.site.urls)), |
51 | ] | 55 | ] + urlpatterns |
52 | # Automatically discover urls.py in various apps, beside our own | 56 | # Automatically discover urls.py in various apps, beside our own |
53 | # and map module directories to the patterns | 57 | # and map module directories to the patterns |
54 | 58 | ||
@@ -61,4 +65,4 @@ for t in os.walk(os.path.dirname(currentdir)): | |||
61 | 65 | ||
62 | if "urls.py" in t[2] and t[0] != currentdir: | 66 | if "urls.py" in t[2] and t[0] != currentdir: |
63 | modulename = os.path.basename(t[0]) | 67 | modulename = os.path.basename(t[0]) |
64 | urlpatterns.append( url(r'^' + modulename + '/', include ( modulename + '.urls'))) | 68 | urlpatterns.insert(0, url(r'^' + modulename + '/', include ( modulename + '.urls'))) |