https://github.com/druids/django-project-info
A small plugin which takes a configuration (like Bower or npm) and it provides data via context processors.
https://github.com/druids/django-project-info
Last synced: 12 months ago
JSON representation
A small plugin which takes a configuration (like Bower or npm) and it provides data via context processors.
- Host: GitHub
- URL: https://github.com/druids/django-project-info
- Owner: druids
- License: mit
- Created: 2014-03-04T11:01:07.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-09-01T19:18:04.000Z (almost 7 years ago)
- Last Synced: 2024-10-18T22:17:43.929Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
django-project-info
===================
A small plugin which takes a configuration (like Bower or npm) and it provides data via context processors.
Usage
-----
### Register plugin in requirements.txt and in you Django configuration
```python
https://github.com/lukasrychtecky/django-project-info/tarball/0.1.0#egg=django-project-info-0.1.0
```
and
```python
TEMPLATE_CONTEXT_PROCESSORS = (
'project_info.context_processors.get_project_info',
)
PIP_CONFIG = 'pip.json'
```
### Create a pip.json (the name depends on you, but must be same in Django configuration)
```json
{
"name": "short project name",
"version": "0.1.0",
"verbose": "verbose project name"
}
```
### Templates
All values from `pip.json` are available in a template via the context processor. Every key is capitalized and prefixed by PROJECT_, e.g. version becomes PROJECT_VERSION.
### Helpers
If you want to get only parsed pip.json file you can use get_project_info_dict
```python
from project_info import get_project_info_dict
get_project_info_dict()
```
You can specify pip config file
```python
get_project_info_dict('pip.json')
```
If you want to get only project version use
```python
from project_info import get_version
get_version()
```
again first parameter can be pip config file
```python
get_version('pip.json')
```