Permalink
Browse files

Admin view for celery configuration.

  • Loading branch information...
James Socol
James Socol committed Dec 10, 2010
1 parent 77760ab commit 44e69dd5e7286e09342e8a5c6f2f4a0a039d78a7
Showing with 20 additions and 5 deletions.
  1. +0 −3 apps/kadmin/models.py
  2. +1 −0 apps/kadmin/urls.py
  3. +19 −2 apps/kadmin/views.py
View
@@ -1,3 +0,0 @@
-from django.db import models
-
-# Create your models here.
View
@@ -6,6 +6,7 @@
urlpatterns = patterns('',
# Kitsune stuff.
+ url('^celery', views.celery_settings, name='kadmin.celery'),
url('^settings', views.settings, name='kadmin.settings'),
url('^env$', views.env, name='kadmin.env'),
View
@@ -1,18 +1,35 @@
+import re
+
from django import http
from django.contrib import admin
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views import debug
+import celery.conf
import jinja2
@admin.site.admin_view
def settings(request):
"""Admin view that displays the django settings."""
settings = debug.get_safe_settings()
- sorted_settings = [{'key': key, 'value': settings[key]}
- for key in sorted(settings.keys())]
+ sorted_settings = [{'key': key, 'value': settings[key]} for
+ key in sorted(settings.keys())]
+
+ return render_to_response('kadmin/settings.html',
+ {'settings': sorted_settings},
+ RequestContext(request, {}))
+
+
+@admin.site.admin_view
+def celery_settings(request):
+ """Admin view that displays the celery configuration."""
+ capital = re.compile('^[A-Z]')
+ settings = [key for key in dir(celery.conf) if capital.match(key)]
+ sorted_settings = [{'key': key, 'value': '*****' if 'password' in
+ key.lower() else getattr(celery.conf, key)} for
+ key in sorted(settings)]
return render_to_response('kadmin/settings.html',
{'settings': sorted_settings},

0 comments on commit 44e69dd

Please sign in to comment.