Skip to main content

Django reusable app to show your project version

Project description

Travis Coveralls Requires License Version Supported Python version Supported Django version Package format Python wheel support Package status

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 }}

Also simple management command print-version which prints project version to stdout is available. Just run: $ python ./manage.py print-version from project folder.

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

from django.conf.urls import url


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-project-version-0.10.0.zip (21.9 kB view details)

Uploaded Source

Built Distribution

django_project_version-0.10.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file django-project-version-0.10.0.zip.

File metadata

  • Download URL: django-project-version-0.10.0.zip
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for django-project-version-0.10.0.zip
Algorithm Hash digest
SHA256 78924058f8ab91f03fd5b33db04e9b9eb6451c797dac15b9442f784683265e30
MD5 b05e2412a134e79b636ccceefe2f4e20
BLAKE2b-256 aa7585a36d972f1d9e0b0384da8e751cc0e7040777dc7069e61f7013a6d49523

See more details on using hashes here.

File details

Details for the file django_project_version-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: django_project_version-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for django_project_version-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33f6b48758fa8a1414b50bb20cb547eac6e0c94652a7a8fb770c843e77ff2518
MD5 8a89234bf710ba96b8d5826a0e870ac7
BLAKE2b-256 0b2c38ae36e3a2bbe249d76856f2d09a29b5f1c1fb6255023c1002d7c6eac74d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page