Browse Source

Update views.py

pull/178/head
Afreed-Sharief 5 years ago
committed by Lumir Balhar
parent
commit
fa88380112
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      welcome/views.py

+ 2
- 0
welcome/views.py View File

@ -9,6 +9,7 @@ from .models import PageView
# Create your views here. # Create your views here.
def index(request): def index(request):
"""Takes an request object as a parameter and creates an pageview object then responds by rendering the index view."""
hostname = os.getenv('HOSTNAME', 'unknown') hostname = os.getenv('HOSTNAME', 'unknown')
PageView.objects.create(hostname=hostname) PageView.objects.create(hostname=hostname)
@ -19,4 +20,5 @@ def index(request):
}) })
def health(request): def health(request):
"""Takes an request as a parameter and gives the count of pageview objects as reponse"""
return HttpResponse(PageView.objects.count()) return HttpResponse(PageView.objects.count())

Loading…
Cancel
Save