Skip to content

Commit

Permalink
find mapstore version from staticdirs in debug mode (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy authored Jun 10, 2021
1 parent 228d532 commit 7b869fa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions geonode_mapstore_client/templatetags/client_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@

from django import template
from django.conf import settings
from django.contrib.staticfiles.finders import find

logger = logging.getLogger(__name__)
register = template.Library()


@register.simple_tag
def client_version():
try:
version_path = 'mapstore/version.txt'
if settings.DEBUG:
file_path = find(version_path)
else:
file_path = os.path.join(
settings.STATIC_ROOT,
'mapstore/version.txt'
version_path
)
try:
with open(file_path, 'r') as f:
version = f.read()
return version
Expand Down

0 comments on commit 7b869fa

Please sign in to comment.