Add heartbeat to cms
This commit is contained in:
0
common/djangoapps/heartbeat/__init__.py
Normal file
0
common/djangoapps/heartbeat/__init__.py
Normal file
5
common/djangoapps/heartbeat/urls.py
Normal file
5
common/djangoapps/heartbeat/urls.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.conf.urls import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', 'heartbeat.views.heartbeat', name='heartbeat'),
|
||||
)
|
||||
15
common/djangoapps/heartbeat/views.py
Normal file
15
common/djangoapps/heartbeat/views.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from django.http import HttpResponse
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
def heartbeat(request):
|
||||
"""
|
||||
Simple view that a loadbalancer can check to verify that the app is up
|
||||
"""
|
||||
output = {
|
||||
'date': datetime.now().isoformat(),
|
||||
'courses': [course.location.url() for course in modulestore().get_courses()],
|
||||
}
|
||||
return HttpResponse(json.dumps(output, indent=4))
|
||||
Reference in New Issue
Block a user