[Django] #31897: Example in `Using settings in Python code` documentation is misleading

9 views
Skip to first unread message

Django

unread,
Aug 17, 2020, 7:04:15 PM8/17/20
to django-...@googlegroups.com
#31897: Example in `Using settings in Python code` documentation is misleading
-------------------------------------+-------------------------------------
Reporter: Garrett | Owner: nobody
Edel |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.1
Documentation | Keywords:
Severity: Normal | settings,documentation
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The current example (https://docs.djangoproject.com/en/3.1/topics/settings
/#using-settings-in-python-code) for how to use from `django.conf import
settings` includes the example of using `settings.DEBUG`.

The example is fine, but if a user tries to replicate this in their test
scripts `settings.DEBUG` will always return `False` as intended in the
design of Django tests
(https://docs.djangoproject.com/en/3.1/topics/testing/overview/#other-
test-conditions). This PR simply adds an admonition in the docs to warn
users about this and offer an alternative with override_settings().

PR here: https://github.com/django/django/pull/13308

--
Ticket URL: <https://code.djangoproject.com/ticket/31897>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 18, 2020, 1:41:28 AM8/18/20
to django-...@googlegroups.com
#31897: Example in `Using settings in Python code` documentation is misleading
-------------------------------------+-------------------------------------
Reporter: Garrett Edel | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 3.1
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
settings,documentation | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => invalid


Comment:

Thanks for this ticket, however I don't see anything misleading in these
examples. IMO we shouldn't mix an example of using settings in Python code
(which is not a `DEBUG` docs) with a design decision about running tests
with `DEBUG =False`, it is beyond the scope of this paragraph.

--
Ticket URL: <https://code.djangoproject.com/ticket/31897#comment:1>

Reply all
Reply to author
Forward
0 new messages