django-extended-settings


Namedjango-extended-settings JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/mickbad/django-extended-settings
SummaryExtended Settings for Django Project with settings.d/
upload_time2023-02-08 12:00:31
maintainer
docs_urlNone
authorMickBad
requires_python>=3.5
licenseBSD
keywords django development tools settings
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-extended-settings
Apps for Django to extend global settings with additional files

Initialize other configuration settings for django project
Other configurations must be set in /path/to/project/djangoproject/settings.d/*_settings.py

        Project/
        |_ apps1/
        |_ ...
        |_ project/
           |_ settings.py
           |_ urls.py
           |_ ...
           |_ settings.d/
              |_ one_settings.py
              |_ second_settings.py

The current version of the Django Extended Settings is 1.2.0. It works on Django ≥ 2.0. (not tested other)

### Installation

#### Getting the code

The recommended way to install the Django Extended Settings is via pip or pipenv:

```bash
$ pip install django-extended-settings
```

#### Prerequisites

Make sure add ```extended_settings``` to your ```INSTALLED_APPS``` setting:

```python
INSTALLED_APPS = [
    # ...
    'extended_settings',
    # ...
]
```

#### Play settings into your project

Create sub directory ```settings.d/``` into django project directory and put your configuration into independant files with this patterns ```*_settings.py```

__sample__  : ```/path/to/project/djangopython/settings.d/production_settings.py```


#### Play database settings

You can add some settings in database

```$ ./manage.py migrate ```

In your python files, you can create settings (in command for example) like this

```python
from extended_settings.models import ExtentedSettings

o = ExtentedSettings()
o.name = "My home page location"
o.key = "hostname"
o.value = "http://localhost:8000"
o.save()
```

To retrieve settings in your views, ...

```python
from extended_settings.models import ExtentedSettings

my_var = ExtentedSettings.get("hostname")
my_var = ExtentedSettings.get("hostname", 'default value')

my_int = ExtentedSettings.get_int("my-int")
my_float = ExtentedSettings.get_float("my-float", 100.0)
my_bool = ExtentedSettings.get_boolean("my-bool") # True = yes, y, true, 1, ...
```


### Misc

The Django Extended Settings is released under the BSD license, like Django itself. If you like it, please consider contributing!

The Django Extended Settings was originally created by Mickael Badet in September 2018.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mickbad/django-extended-settings",
    "name": "django-extended-settings",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "django development tools settings",
    "author": "MickBad",
    "author_email": "prog@mickbad.com",
    "download_url": "https://files.pythonhosted.org/packages/0d/98/c418fb1c322d61a4e7358a1bcaca5a8995733525c0bc96ec4da4122dff92/django-extended-settings-1.2.1.tar.gz",
    "platform": null,
    "description": "# django-extended-settings\nApps for Django to extend global settings with additional files\n\nInitialize other configuration settings for django project\nOther configurations must be set in /path/to/project/djangoproject/settings.d/*_settings.py\n\n        Project/\n        |_ apps1/\n        |_ ...\n        |_ project/\n           |_ settings.py\n           |_ urls.py\n           |_ ...\n           |_ settings.d/\n              |_ one_settings.py\n              |_ second_settings.py\n\nThe current version of the Django Extended Settings is 1.2.0. It works on Django \u2265 2.0. (not tested other)\n\n### Installation\n\n#### Getting the code\n\nThe recommended way to install the Django Extended Settings is via pip or pipenv:\n\n```bash\n$ pip install django-extended-settings\n```\n\n#### Prerequisites\n\nMake sure add ```extended_settings``` to your ```INSTALLED_APPS``` setting:\n\n```python\nINSTALLED_APPS = [\n    # ...\n    'extended_settings',\n    # ...\n]\n```\n\n#### Play settings into your project\n\nCreate sub directory ```settings.d/``` into django project directory and put your configuration into independant files with this patterns ```*_settings.py```\n\n__sample__  : ```/path/to/project/djangopython/settings.d/production_settings.py```\n\n\n#### Play database settings\n\nYou can add some settings in database\n\n```$ ./manage.py migrate ```\n\nIn your python files, you can create settings (in command for example) like this\n\n```python\nfrom extended_settings.models import ExtentedSettings\n\no = ExtentedSettings()\no.name = \"My home page location\"\no.key = \"hostname\"\no.value = \"http://localhost:8000\"\no.save()\n```\n\nTo retrieve settings in your views, ...\n\n```python\nfrom extended_settings.models import ExtentedSettings\n\nmy_var = ExtentedSettings.get(\"hostname\")\nmy_var = ExtentedSettings.get(\"hostname\", 'default value')\n\nmy_int = ExtentedSettings.get_int(\"my-int\")\nmy_float = ExtentedSettings.get_float(\"my-float\", 100.0)\nmy_bool = ExtentedSettings.get_boolean(\"my-bool\") # True = yes, y, true, 1, ...\n```\n\n\n### Misc\n\nThe Django Extended Settings is released under the BSD license, like Django itself. If you like it, please consider contributing!\n\nThe Django Extended Settings was originally created by Mickael Badet in September 2018.\n\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Extended Settings for Django Project with settings.d/",
    "version": "1.2.1",
    "split_keywords": [
        "django",
        "development",
        "tools",
        "settings"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d98c418fb1c322d61a4e7358a1bcaca5a8995733525c0bc96ec4da4122dff92",
                "md5": "ed627be717c3c2958745ffccdba750f7",
                "sha256": "0742a60dbf59a7b30ccedf494d5bed57cd4b5725a430f10f8ce5afb8b6814a85"
            },
            "downloads": -1,
            "filename": "django-extended-settings-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ed627be717c3c2958745ffccdba750f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 6801,
            "upload_time": "2023-02-08T12:00:31",
            "upload_time_iso_8601": "2023-02-08T12:00:31.430519Z",
            "url": "https://files.pythonhosted.org/packages/0d/98/c418fb1c322d61a4e7358a1bcaca5a8995733525c0bc96ec4da4122dff92/django-extended-settings-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-08 12:00:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mickbad",
    "github_project": "django-extended-settings",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-extended-settings"
}
        
Elapsed time: 0.03754s