Commit 54a08489 by Bence Dányi

cloud: stat context processor

parent 1bde322c
from cloud.settings import DEBUG from cloud.settings import DEBUG, STAT_DEBUG
from django.core.cache import cache
import subprocess
import json
def process_debug(req): def process_debug(req):
return {'DEBUG': DEBUG} return {'DEBUG': DEBUG}
def process_stat(req):
# stat = cache.get('cloud_stat');
stat = json.loads(subprocess.check_output(['/opt/webadmin/cloud/miscellaneous/stat/stat_wrap.sh']))
return {
'STAT_DEBUG': STAT_DEBUG,
'cloud_stat': stat,
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
STAT_DEBUG = True
ADMINS = ( ADMINS = (
('IK', 'cloud@ik.bme.hu'), ('IK', 'cloud@ik.bme.hu'),
...@@ -119,6 +120,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( ...@@ -119,6 +120,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.tz', 'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'cloud.context_processors.process_debug', 'cloud.context_processors.process_debug',
'cloud.context_processors.process_stat',
) )
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment