rbmd_django/rbmd/views.py

35 lines
768 B
Python
Raw Normal View History

2017-08-31 00:52:20 +03:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import HttpResponse
from django.shortcuts import render
import json
import requests
def get_metrics():
with open('conf.json') as conf:
api = json.load(conf)["api"]
print api
#try: res = requests.get(api + metrics)
return api
def panel(request):
with open('conf.json') as conf:
ws = json.load(conf)["ws"]
metrics = get_metrics()
return render(request, 'rbmd/index.html', {'ws' : ws, 'metrics' : metrics})
def get_status(request):
with open('conf.json') as conf:
status = json.load(conf)["status"]
#try: res = requests.get(status)
return HttpResponse(status)
def mount():
pass
def unmount():
pass