Temporary backup from J621 porting
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import time
|
||||
from .os_utils import get_os_info
|
||||
from django.conf import settings
|
||||
|
||||
def app_version(request):
|
||||
os_icon, os_name = get_os_info()
|
||||
page_gen_time = ''
|
||||
if hasattr(request, '_start_time') and request._start_time:
|
||||
elapsed = time.time() - request._start_time
|
||||
page_gen_time = f"{elapsed * 1000:.0f}ms"
|
||||
return {
|
||||
'APP_ENV': 'dev' if settings.DEBUG else 'prod',
|
||||
'GIT_COMMIT_HASH': getattr(settings, 'GIT_COMMIT_HASH', 'unknown'),
|
||||
'OS_ICON': os_icon,
|
||||
'OS_NAME': os_name,
|
||||
'PAGE_GEN_TIME': page_gen_time,
|
||||
}
|
||||
Reference in New Issue
Block a user