Skip to main content

A re-useable Django app for building models that modify Django settings.

Project description

Settings Model

TravisCI PyPI Coveralls Code Style

Documentation: https://django-settings-model.readthedocs.io

Source: https://github.com/gregschmit/django-settings-model

PyPI: https://pypi.org/project/django-settings-model/

This Django reusable app implements a base SettingsModel class to allow settings to be edited and saved in the database. For any particular project, you probably want to customize which settings are exposed, so while there is a Settings example implementation that you can use, the abstract model SettingsModel can be used to construct your own settings model(s), and things like webserver restarts are handled in the abstract model class.

The Problem: Sometimes you want to build an app that can run on an arbitrary piece of equipment, and things like timezone, hostname, or SMTP settings may need to be editable from the UI.

The Solution: This app implements a base SettingsModel class that allows you to expose settings to a user interface via the database.

How to Use

$ pip install django-settings-model

You can either create your own custom settings model, inheriting from settings_model.models.SettingsModel, or you can use the example implementation provided in the settings_model.models.Settings model. If you include settings_model in your INSTALLED_APPS, then that model will be migrated to your database when you run python3 manage.py migrate and you will see the settings in the admin site. You need to add the following to the end of your settings.py file:

try:
    from .model_settings import *
except:
    pass

If you create a custom Settings model, then ensure you call its .init() class method in the application’s AppConfig.ready() method. This will update the settings with the true values (and optionally create an initial settings model instance) on startup.

Settings

  • SETTINGS_MODEL_REBOOT_FILES (default []): This is a list of files that should be touched when the settings model is saved to signal to the webserver to update. If it is falsy, then the system will try to find and touch the file BASE_DIR/manage.py and the wsgi.py file defined by WSGI_APPLICATION.

Contributing

Submit a pull request if you would like to contribute. You must only contribute code that you have authored or otherwise hold the copyright to, and you must make any contributions to this project available under the MIT license.

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-settings-model-0.3.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

django_settings_model-0.3.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file django-settings-model-0.3.1.tar.gz.

File metadata

  • Download URL: django-settings-model-0.3.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for django-settings-model-0.3.1.tar.gz
Algorithm Hash digest
SHA256 fbd5c55b4c704852fda5cfec74e84f051a52dfdbe4d386d0ef7687b7c3b8cfe0
MD5 8da0d2633e419ab6c6f97b542decf0b3
BLAKE2b-256 acd0310ac79c5837a7b02a9b75af6c7c99b0c51c77eaf2bfb1a79948f31d96b5

See more details on using hashes here.

Provenance

File details

Details for the file django_settings_model-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: django_settings_model-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for django_settings_model-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5cd6150f72ce08fadcd9e6545d3eb53adb5de53c1038381c2f0fa752eea38259
MD5 d02a06c8be3375d14759aa6a5484f060
BLAKE2b-256 fdb9c03f2c6399b425892108ff67589bd1924a45321c095dbadd1707d93894fb

See more details on using hashes here.

Provenance

Supported by

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