#25999: Document why Django makes its deprecation warnings loud by default and 
how
to silence them
------------------------------------------------+------------------------
               Reporter:  timgraham             |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Documentation         |        Version:  master
               Severity:  Normal                |       Keywords:
           Triage Stage:  Accepted              |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 See #18985 for the background of why we route warnings through logging.

 A developer can selectively silence warnings using something like this in
 an app's `AppConfig.ready()` method:
 {{{
 import warnings
 from django.utils.deprecation import RemovedInNextVersionWarning
 warnings.simplefilter("ignore", RemovedInNextVersionWarning)
 }}}
 This example can be improved to show how to silence a particular warning
 instead of all warnings.

 This works because `AppConfig.ready()` methods are called after
 `django.utils.log.configure_logging()` (which does
 `warnings.simplefilter("default", RemovedInNextVersionWarning)`) in
 `django.setup()`.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.7dac1c7f54e1442a19701557bf547661%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to