Merge pull request #167 from Afreed-Sharief/master

Update views.py by giving documentation to the each view.
This commit is contained in:
Lumír 'Frenzy' Balhar 2020-10-01 10:25:12 +02:00 committed by GitHub
commit 7e718f9fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,7 @@ from .models import PageView
# Create your views here.
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')
PageView.objects.create(hostname=hostname)
@ -19,4 +20,5 @@ def index(request):
})
def health(request):
"""Takes an request as a parameter and gives the count of pageview objects as reponse"""
return HttpResponse(PageView.objects.count())