Django reusable app to show your project version
Project description
django-project-version is a Django reusable app to show your project version
Installation
Obtain your copy of source code from the git repository: git clone https://github.com/DCOD-OpenSource/django-project-version.git. Or download the latest release from https://github.com/DCOD-OpenSource/django-project-version/tags/.
Run python ./setup.py install from the repository source tree or unpacked archive. Or use pip: pip install django-project-version.
Configuration
Add "djversion" to settings.INSTALLED_APPS.
# settings.py
INSTALLED_APPS += [
"djversion",
]
Settings
- DJVERSION_VERSION
Contains project version. Defaults to None.
- DJVERSION_UPDATED
Contains project update date or datetime. Defaults to None.
- DJVERSION_FORMAT_STRING
Contains version and updated format string. Defaults to "{version} ({updated})".
- DJVERSION_GIT_REPO_PATH
Contains path to git repository from where version info can get. Defaults to None.
- DJVERSION_GIT_USE_TAG
Indicate usage of git repository current tag as project version. Defaults to False.
- DJVERSION_GIT_USE_COMMIT
Indicate usage of git repository last commit hash as project version. Defaults to False.
Usage
If you want always have "VERSION" variable in templates context, just add "djversion.context_processors.version" to settings.TEMPLATE_CONTEXT_PROCESSORS
# settings.py
TEMPLATE_CONTEXT_PROCESSORS += [
"djversion.context_processors.version",
]
Or you can use project_version templatetag which can be loaded from djversion_tags.
{# footer.html #}
{% load djversion_tags %}
{% project_version as VERSION %}
{{ VERSION }}
Advanced features
If you want to have REST-style view with your project version:
Install django-project-version with additional dependencies: pip install django-project-version[rest].
Extend you settings.INSTALLED_APPS by adding "rest_framework".
# settings.py
INSTALLED_APPS += [
"rest_framework",
]
Add "djversion" to your URLs definitions:
# urls.py
urlpatterns += [
url(r"^version/", include("djversion.urls")),
]
Or to use information from the project git repository as project version:
Install django-project-version with additional dependencies: pip install django-project-version[git].
Configure git related settings.
Licensing
django-project-version uses the MIT license. Please check the MIT-LICENSE file for more details.
Contacts
Project Website: https://github.com/DCOD-OpenSource/django-project-version/
Author: DCOD <contact@d-cod.com>
For other authors list see AUTHORS file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-project-version-0.6.4.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5092cd91af6ea9347315f58664f1b804c7ffcf917f6855fd8c530ea535563777 |
|
MD5 | 4e2eb71f5f77e6dc4490b9a6e6346d5b |
|
BLAKE2b-256 | ac4f6ca8e8a0bbfb24de0c9e17317a9d0d7f1f78e5ff4dd3fb5ce41cae65364f |
Hashes for django_project_version-0.6.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c348d3f6bdd2c7240a613dce41b0433ed7a72c81b60f94fd3e887cdea95e3cee |
|
MD5 | dd8c7da39776adc4802c0e045535000f |
|
BLAKE2b-256 | 8534e4c2741da50a1e880be1ad432a4b23b500031e39c3a67b51861be74697b5 |