{"id":13415589,"url":"https://github.com/wemake-services/django-split-settings","last_synced_at":"2025-05-14T18:04:18.175Z","repository":{"id":8506532,"uuid":"10117110","full_name":"wemake-services/django-split-settings","owner":"wemake-services","description":"Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.","archived":false,"fork":false,"pushed_at":"2025-05-08T16:18:22.000Z","size":1505,"stargazers_count":1155,"open_issues_count":7,"forks_count":68,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-08T17:31:49.610Z","etag":null,"topics":["django","django-configuration","django-settings","python","python3","settings"],"latest_commit_sha":null,"homepage":"http://django-split-settings.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wemake-services.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"wemake-services","custom":"https://boosty.to/sobolevn"}},"created_at":"2013-05-17T06:04:30.000Z","updated_at":"2025-05-08T17:06:25.000Z","dependencies_parsed_at":"2024-03-29T13:28:22.289Z","dependency_job_id":"aed69435-3e9b-4725-964a-b36eb6bc4056","html_url":"https://github.com/wemake-services/django-split-settings","commit_stats":{"total_commits":476,"total_committers":25,"mean_commits":19.04,"dds":0.6596638655462185,"last_synced_commit":"a07be88db759cdccd67685a02b5816b15a3a8955"},"previous_names":["sobolevn/django-split-settings"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fdjango-split-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fdjango-split-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fdjango-split-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fdjango-split-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wemake-services","download_url":"https://codeload.github.com/wemake-services/django-split-settings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253980963,"owners_count":21994178,"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":["django","django-configuration","django-settings","python","python3","settings"],"created_at":"2024-07-30T21:00:50.549Z","updated_at":"2025-05-14T18:04:18.109Z","avatar_url":"https://github.com/wemake-services.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/sobolevn/django-split-settings/master/docs/_static/logo-black.png\"\n       alt=\"django-split-settings logo\"\u003e\n\u003c/p\u003e\n\n---\n\n[![wemake.services](https://img.shields.io/badge/%20-wemake.services-green.svg?label=%20\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC%2FxhBQAAAAFzUkdCAK7OHOkAAAAbUExURQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP%2F%2F%2F5TvxDIAAAAIdFJOUwAjRA8xXANAL%2Bv0SAAAADNJREFUGNNjYCAIOJjRBdBFWMkVQeGzcHAwksJnAPPZGOGAASzPzAEHEGVsLExQwE7YswCb7AFZSF3bbAAAAABJRU5ErkJggg%3D%3D)](https://wemake.services)\n[![test](https://github.com/wemake-services/django-split-settings/actions/workflows/test.yml/badge.svg?branch=master\u0026event=push)](https://github.com/wemake-services/django-split-settings/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/sobolevn/django-split-settings/branch/master/graph/badge.svg)](https://codecov.io/gh/sobolevn/django-split-settings)\n[![Docs](https://readthedocs.org/projects/django-split-settings/badge/?version=latest)](http://django-split-settings.readthedocs.io/en/latest/?badge=latest)\n[![Python Version](https://img.shields.io/pypi/pyversions/django-split-settings.svg)](https://pypi.org/project/django-split-settings/)\n[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide)\n\n\n\nOrganize Django settings into multiple files and directories. Easily\noverride and modify settings. Use wildcards in settings file paths\nand mark settings files as optional.\n\nRead [this blog post](https://sobolevn.me/2017/04/managing-djangos-settings)\nfor more information.\nAlso, check this [example project](https://github.com/wemake-services/wemake-django-template).\n\n\n## Requirements\n\nWhile this package will most likely work with the most versions of `django`, we [officially support](https://github.com/sobolevn/django-split-settings/blob/master/.github/workflows/test.yml):\n\n- 4.2\n- 5.0\n- 5.1\n\nThis package has no dependencies itself.\n\nIn case you need older `python` / `django` versions support,\nthen consider using older versions of `django-split-settings`.\n\n\n## Installation\n\n```bash\npip install django-split-settings\n```\n\n\n## Usage\n\nReplace your existing `settings.py` with a list of components that\nmake up your Django settings. Preferably create a settings package\nthat contains all the files.\n\nHere's a minimal example:\n\n```python\nfrom split_settings.tools import optional, include\n\ninclude(\n    'components/base.py',\n    'components/database.py',\n    optional('local_settings.py')\n)\n```\n\nIn the example, the files `base.py` and `database.py` are included\nin that order from the subdirectory called `components/`.\n`local_settings.py` in the same directory is included if it exists.\n\n**Note:** The local context is passed on to each file, so each\nfollowing file can access and modify the settings declared in the\nprevious files.\n\nWe also made an in-depth [tutorial](https://sobolevn.me/2017/04/managing-djangos-settings).\n\n\n## Tips and tricks\n\nYou can use wildcards in file paths:\n\n```python\ninclude('components/my_app/*.py')\n```\n\nNote that files are included in the order that `glob` returns them,\nprobably in the same order as what `ls -U` would list them. The\nfiles are NOT in alphabetical order.\n\nYou can modify common settings in environment settings simply importing them\n\n```python\n# local_settings.py\nfrom components.base import INSTALLED_APPS\n\nINSTALLED_APPS += (\n  'raven.contrib.django.raven_compat',\n)\n```\n\n\n## Updating `BASE_DIR`\n\nThe `django create-project` command will create a variable in your `settings.py` called `BASE_DIR`, which is often used to locate static files, media files, and templates.\n\n```python\n# Created by django create-project\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nSTATIC_ROOT = os.path.join(BASE_DIR, \"staticfiles/\")\nMEDIA_ROOT = os.path.join(BASE_DIR, \"mediafiles/\")\n```\n\nThe expression for `BASE_DIR` means: get the path to the current file (`settings.py`), get the parent folder (whatever you named your project), get the parent folder (the root of the project). So `STATIC_ROOT` will then be evaluated to `/staticfiles` (with `/` meaning the root of your project/repo).\n\nWith `django-split-settings` `settings` is now a module (instead of a file), so `os.path.dirname(os.path.dirname(os.path.abspath(__file__)))` will evaluate to `/whatever-you-named-your-project` as opposed to `/`.\n\nTo fix this `BASE_DIR` needs to be set to the parent folder of `/whatever-you-named-your-project`:\n\n```python\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n```\n\n## Do you want to contribute?\n\nRead the [CONTRIBUTING.md](https://github.com/sobolevn/django-split-settings/blob/master/CONTRIBUTING.md) file.\n\n\n## Version history\n\nSee [CHANGELOG.md](https://github.com/sobolevn/django-split-settings/blob/master/CHANGELOG.md) file.\n","funding_links":["https://github.com/sponsors/wemake-services","https://boosty.to/sobolevn"],"categories":["Third-Party Packages","Python","Django Utilities"],"sub_categories":["Configuration"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Fdjango-split-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwemake-services%2Fdjango-split-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Fdjango-split-settings/lists"}