Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report version in index page. #427

Merged
merged 5 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
datacube_wms/wms_cfg_local.py
.pytest_cache
*/__pycache__
.git
*/__pycache__
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN mkdir -p /code
WORKDIR /code
ADD . /code

RUN echo "version=\"`python setup.py --version`\"" > datacube_ows/_version.py
RUN pip install .


Expand Down
2 changes: 1 addition & 1 deletion datacube_ows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
try:
from ._version import version as __version__
except ImportError:
__version__ = "Unknown - 1.8.x+?"
__version__ = "1.8.1+?"
9 changes: 8 additions & 1 deletion datacube_ows/ogc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from flask import g, render_template, request
from flask_log_request_id import current_request_id

from datacube_ows import __version__
from datacube_ows.legend_generator import create_legend_for_style
from datacube_ows.ogc_utils import capture_headers, resp_headers, get_service_base_url, lower_get_args
from datacube_ows.wms import WMS_REQUESTS
Expand Down Expand Up @@ -73,7 +74,13 @@ def ogc_impl():
cfg = get_config()
url = nocase_args.get('Host', nocase_args['url_root'])
base_url = get_service_base_url(cfg.allowed_urls, url)
return (render_template("index.html", cfg=cfg, supported=OWS_SUPPORTED, base_url=base_url),
return (render_template(
"index.html",
cfg=cfg,
supported=OWS_SUPPORTED,
base_url=base_url,
version=__version__,
),
200,
resp_headers({"Content-Type": "text/html"}))
except OGCException as e:
Expand Down
4 changes: 1 addition & 3 deletions datacube_ows/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
</head>

<body>
<!-- Just an image -->
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">
<!-- <img src="https://docs.dea.ga.gov.au/_static/dea-logo-inline.svg" height="60" alt="{{ cfg.title }} (datacube-ows)" loading="lazy"> -->
{{ cfg.title }} (datacube-ows)
{{ cfg.title }} (datacube-ows v{{ version }})
</a>
</nav>
<div class="jumbotron jumbotron-fluid" style="background-color: rgba(233, 236, 239, 0.6);">
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ blinker
pyows
owslib
pytest-helpers-namespace
prometheus-flask-exporter
prometheus-flask-exporter
setuptools_scm
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
'geoalchemy',
'xarray',
'pyows',
'prometheus-flask-exporter'
'prometheus-flask-exporter',
#
'setuptools_scm'
]

test_requirements = [
Expand Down Expand Up @@ -68,6 +70,8 @@
'Natural Language :: English',
'Programming Language :: Python :: 3.5',
],
setup_requires=['setuptools_scm'],
use_scm_version=True,
test_suite='tests',
tests_require=test_requirements
)