settings.configure(types.SimpleNamespace(foo="bar"), baz="qux")
print(settings.foo, settings.baz) # Doesn't error
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30234>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:1>
Comment (by orlnub123):
Just non-upper ones. Some components such as diffsettings or the debug
view rely on there only being uppercase settings.
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"163236ea0e5df1a301371e79ec35fc67b7a1b7a6" 163236e]:
{{{
#!CommitTicketReference repository=""
revision="163236ea0e5df1a301371e79ec35fc67b7a1b7a6"
Fixed #30234 -- Disallowed non-upper settings in settings.configure().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:4>
Comment (by k4ml):
The docs still showing example that using `_` in settings.py -
https://github.com/django/django/blob/7f33c1e22dbc34a7afae7967783725b10f1f13b1/docs/ref/settings.txt#L1951
And this check cause issue when third party app is calling
settings.configure():-
https://github.com/idlesign/pytest-
djangoapp/blob/master/pytest_djangoapp/plugin.py#L42
If this is no longer recommended practice, the docs above should be fixed
not to use `_` anymore in settings.py.
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:5>
Comment (by Mariusz Felisiak):
Replying to [comment:5 k4ml]:
> The docs still showing example that using `_` in settings.py -
https://github.com/django/django/blob/7f33c1e22dbc34a7afae7967783725b10f1f13b1/docs/ref/settings.txt#L1951
>
> And this check cause issue when third party app is calling
settings.configure():-
>
> https://github.com/idlesign/pytest-
djangoapp/blob/master/pytest_djangoapp/plugin.py#L42
>
> If this is no longer recommended practice, the docs above should be
fixed not to use `_` anymore in settings.py.
This ticket has nothing to do with using `_` in `settings.py`, it's about
non-uppercase setting names.
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:6>
Comment (by k4ml):
Replying to [comment:6 Mariusz Felisiak]:
> This ticket has nothing to do with using `_` in `settings.py`, it's
about non-uppercase setting names.
`_` failed `isupper()` check.
Btw the fix is simple actually, add:-
```
del _
```
at the end of settings.py. The localization docs should add this in notes.
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:7>
Comment (by Mariusz Felisiak):
Replying to [comment:7 k4ml]:
> Btw the fix is simple actually, add:-
>
>
> del _
>
> at the end of settings.py. The localization docs should add this in
notes.
It's not an issue in Django or its docs. It's an issue in
`pytest_djangoapp`. `_` is not a setting name and should not be passed to
the `.configure()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30234#comment:8>