old_console/console/services/product.py
2024-11-02 14:12:45 +03:00

18 lines
564 B
Python

import os
from django.conf import settings
def load_product_version():
"""Get product version from file"""
file_name = os.path.join(settings.BASE_DIR, 'product_version')
return_text = {'product': 'InfoWatch ARMA Management Console', 'version': 'None'}
if os.path.exists(file_name):
with open(file_name, 'r') as f:
try:
return_text['version'] = f.readline().split(':')[1]
return return_text
except ValueError:
return return_text
else:
return return_text