django-ex/welcome/views.py
Rodolfo Carvalho 3015a46f9a Improve database info
Support for MySQL, include SQLite persistence warning.
2015-05-29 17:14:34 +02:00

18 lines
443 B
Python

import os
from django.shortcuts import render
from django.conf import settings
from . import database
from .models import PageView
# Create your views here.
def index(request):
hostname = os.getenv('HOSTNAME', 'unknown')
PageView.objects.create(hostname=hostname)
return render(request, 'welcome/index.html', {
'hostname': hostname,
'database': database.info(),
'count': PageView.objects.count()
})