django-dbsettings/README.md

39 lines
1.1 KiB
Markdown
Raw Normal View History

2020-04-16 07:07:23 +00:00
# django-dbsettings
dbsettings is a simple reusable Django app allowing you to store key-value
pairs in your database, so you can store configuation in your database easily.
## Quick start
2020-05-25 17:21:59 +00:00
1. Add "dbsettings" to your INSTALLED_APPS setting like this:
2020-04-16 07:07:23 +00:00
2020-05-25 17:21:59 +00:00
```python
INSTALLED_APPS = [
...,
2020-05-25 17:14:26 +00:00
'dbsettings',
2020-04-16 07:07:23 +00:00
]
2020-05-25 17:21:59 +00:00
```
2020-04-16 07:07:23 +00:00
2020-05-25 17:14:26 +00:00
2. Run ``python manage.py makemigrations dbsettings`` and
2021-02-12 13:20:38 +00:00
``python manage.py migrate dbsettings`` to create the models.
2020-04-16 07:07:23 +00:00
3. Start the development server and visit http://127.0.0.1:8000/admin/
to add configuration values or use dbsettings.functions.setValue(key, value)
in your code.
4. To retrieve a configuration value from the database, use
dbsettings.functions.getValue(key) in your code.
2020-05-25 17:10:54 +00:00
## Upgrade notes
When upgrading to 0.9 from a previous version, your database tables will need
to be updated. To do this, just execute step 2 from the "Quick start" section
2021-02-12 13:31:44 +00:00
again.
When upgrading to 0.9.5 or later from a previous version, you should first
uninstall the old version. To do that, run:
```
pip uninstall django-dbsettings
pip install dbsettings
```