{"id":17720214,"url":"https://github.com/gregschmit/django-settings-model","last_synced_at":"2025-06-15T07:03:58.821Z","repository":{"id":57421884,"uuid":"216153680","full_name":"gregschmit/django-settings-model","owner":"gregschmit","description":null,"archived":false,"fork":false,"pushed_at":"2019-12-04T03:49:47.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T15:18:35.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregschmit.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-19T05:22:50.000Z","updated_at":"2021-09-23T09:43:33.000Z","dependencies_parsed_at":"2022-09-10T13:21:45.914Z","dependency_job_id":null,"html_url":"https://github.com/gregschmit/django-settings-model","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregschmit/django-settings-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregschmit%2Fdjango-settings-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregschmit%2Fdjango-settings-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregschmit%2Fdjango-settings-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregschmit%2Fdjango-settings-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregschmit","download_url":"https://codeload.github.com/gregschmit/django-settings-model/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregschmit%2Fdjango-settings-model/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259935605,"owners_count":22934386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-25T15:26:31.813Z","updated_at":"2025-06-15T07:03:58.806Z","avatar_url":"https://github.com/gregschmit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Settings Model\n==============\n\n.. inclusion-marker-do-not-remove\n\n.. image:: https://travis-ci.org/gregschmit/django-settings-model.svg?branch=master\n    :alt: TravisCI\n    :target: https://travis-ci.org/gregschmit/django-settings-model\n\n.. image:: https://img.shields.io/pypi/v/django-settings-model\n    :alt: PyPI\n    :target: https://pypi.org/project/django-settings-model/\n\n.. image:: https://coveralls.io/repos/github/gregschmit/django-settings-model/badge.svg?branch=master\n    :alt: Coveralls\n    :target: https://coveralls.io/github/gregschmit/django-settings-model?branch=master\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :alt: Code Style\n    :target: https://github.com/ambv/black\n\nDocumentation: https://django-settings-model.readthedocs.io\n\nSource: https://github.com/gregschmit/django-settings-model\n\nPyPI: https://pypi.org/project/django-settings-model/\n\nThis Django reusable app implements a base ``SettingsModel`` class to allow settings to\nbe edited and saved in the database. For any particular project, you probably want to\ncustomize which settings are exposed, so while there is a ``Settings`` example\nimplementation that you can use, the abstract model ``SettingsModel`` can be used to\nconstruct your own settings model(s), and things like webserver restarts are handled in\nthe abstract model class.\n\n**The Problem**: Sometimes you want to build an app that can be managed by\nnon-developers, and things like timezone, hostname, or SMTP settings may need to be\neditable from the UI.\n\n**The Solution**: This app implements a base ``SettingsModel`` class that allows you to\nexpose settings to a user interface via the database. It writes these stub settings to\nseparate files which you try/include at the end of your main settings file. This way\nyou have sensible defaults, but when the user created/edits a model file in the UI,\nthose settings override. There is a mechanism to touch the ``wsgi.py``/``manage.py``\nfiles when saving, so the only thing left to do is either configure your web server to\nwatch those files and reboot when they are touched, or use a tool like ``incrond`` to\nwatch those files and trigger your webserver to reboot when they are touched.\n\n\nHow to Use\n==========\n\n.. code-block:: shell\n\n    $ pip install django-settings-model\n\n\nYou can use the builtin ``Settings`` model by including this app (``settings_model``) in\nyour ``INSTALLED_APPS`` and running migrations, or you can create your own custom\nsettings model, inheriting from ``settings_model.base.SettingsModel``. If you want to\nbuild a custom settings Model, use the ``Settings`` model as a reference implementation.\n\nFor the included ``Settings`` model, you need to add the following to the end of your\n``settings.py`` file:\n\n.. code-block:: python\n\n    try:\n        from .model_settings import *\n    except:\n        pass\n\n\nIf you create a custom Settings model, then ensure you set the ``__settings_filename__``\nappropriately (avoid conflicts with other settings models), and ensure you call its\n``.init()`` class method in the application's ``AppConfig.ready()`` method. This will\nupdate the settings with the true values (and optionally create an initial settings\nmodel instance) on startup.\n\n\nSettings\n--------\n\n- ``SETTINGS_MODEL_REBOOT_FILES`` (default ``[]``): This is a list of files that should\n  be touched when the settings model is saved to signal to the webserver to reboot. If\n  it is falsy, then the system will try to find and touch the file\n  ``BASE_DIR/manage.py`` and the ``wsgi.py`` file defined by ``WSGI_APPLICATION``.\n\n\nContributing\n============\n\nSubmit a pull request if you would like to contribute. You must only contribute code\nthat you have authored or otherwise hold the copyright to, and you must make any\ncontributions to this project available under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregschmit%2Fdjango-settings-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregschmit%2Fdjango-settings-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregschmit%2Fdjango-settings-model/lists"}