-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathviews.py
49 lines (33 loc) · 1.14 KB
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
from django import get_version
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.conf import settings
def get_python_version():
return sys.version
def get_database_engine():
return settings.DATABASES['default']['ENGINE'].split('.')[-1]
def get_installed_apps():
return settings.INSTALLED_APPS
def get_debug_mode():
return settings.DEBUG
def get_template_debug_mode():
return settings.TEMPLATE_DEBUG
def get_path(request):
path = request.META.get('PATH', None)
if path:
return [p for p in path.split(":")]
return None
def info(request):
context = {
'django_version': get_version(),
'database_engine': get_database_engine(),
'python_version': get_python_version(),
# settings
'settings_debug_mode': get_debug_mode(),
'settings_template_debug_mode': get_template_debug_mode(),
'settings_installed_apps': get_installed_apps(),
'paths': get_path(request),
}
return render_to_response('index.html', context,
context_instance=RequestContext(request))