#35985: FORCE_SCRIPT_NAME ignored when running reverse() on non-main thread
-------------------------------------+-------------------------------------
Reporter: Pēteris Caune | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Core (URLs) | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Pēteris Caune):
Thanks for looking into it, Natalia!
I agree, this is a niche use case (in fact, two niche use cases combined –
serving app on subpath, //and// using threads in a management command),
and so perhaps not worth the effort and risk of changing
`django.urls.base._prefixes`.
> For a workaround, Django will set the prefix when setup is called,
perhaps the best option for your management command is to call setup in
each thread?
I'm not sure – I'm using threads in management commands with no specific
per-thead initialization currently, and the threads are able to access
Django settings, models, etc. I suspect calling `django.setup()` in each
thread would do duplicate work and initialize stuff that is already
initialized.
----
How about documenting `set_script_prefix()`? In
https://docs.djangoproject.com/en/5.1/ref/urlresolvers/#get-script-prefix
there is a section for `get_script_prefix` but not for
`set_script_prefix`. I cannot promise any quality, but I'm happy to take a
first stab at it.
--
Ticket URL: <https://code.djangoproject.com/ticket/35985#comment:3>
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 view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070193abebb2f3-1ba280a7-9a95-44bd-bd3e-3a81420e6aff-000000%40eu-central-1.amazonses.com.