#29673: Thread urlconf isn't reset after response complete
---------------------------------------+------------------------
Reporter: tpict | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
When setting the urlconf on a request (e.g. in middleware for handling
multiple domains pointing to the same Django app), it's not reset until
the start of the next request. Since urlconf is threadlocal, this causes
problems when running a suite of tests, even if the tests pass when ran
individually. For example:
- Django test client makes a request that triggers a middleware to change
the urlconf
- `reverse` is called with no `urlconf` kwarg, expecting to be given the
urlconf specified by `ROOT_URLCONF`
- test throws `NoReverseMatch`
I took this problem to the IRC and found that another person recently
messaged about the same thing:
https://botbot.me/freenode/django/2018-08-07/?msg=103000008&page=3
--
Ticket URL: <https://code.djangoproject.com/ticket/29673>
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/048.e17729e2c6afca3051e37ea7d7fe9084%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.