django / django/new-features

read `DJANGO_SETTINGS_MODULE` from pyproject.toml

Open
#158 9 comments 13 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Feature Description

right now `DJANGO_SETTINGS_PROJECT` can only be configured by env vars, i think django should also support pyproject.toml
[django-cmd](https://github.com/ryanhiebert/django-cmd) already does this, but maybe adding it to django itself could be good

### Problem

1. env vars are temporary, unless using additional tools like direnv
2. path handling is sometimes not as easy as it should be, specially with more complex layering
3. right now multiple django related tools (like pytest-django and django-stubs) enforce their own version of pyproject table to point to settings module, which causes repetition
4. pyprojct is becomming a wildly acceptable standard, other tools such as pytest, tox, ruff and... are using itfor project configuration

### Request or proposal

proposal

### Implementation Suggestions

as i mentioned `django-cmd` already has an implementation, which handles pathing and src layers, i think it (maybe) can be just moved to django as is, or with minimal work.

this would keep support of env vars, and env vars take precedent over toml, which will both keep backwards compatibility, and allow projects with multiple setting files to work

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.