--
Ticket URL: <https://code.djangoproject.com/ticket/16734>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
Based on code inspection, I confirm that this bug exists.
Possible fix: `django.core.management.setup_environ` could do something
along the lines of:
{{{
from django.conf import settings
from django.core.management.base import set_script_prefix
from django.utils.encoding import force_unicode
set_script_prefix(u'/' if settings.FORCE_SCRIPT_NAME is None else
force_unicode(settings.FORCE_SCRIPT_NAME))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:1>
* cc: julenx@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:2>
* cc: AkosLadanyi (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:3>
Comment (by AkosLadanyi):
If it is not possible to figure out the value of script_prefix in all
cases (like in manage.py) why not just store its value in a settings
variable? Then reverse could just prepend this value to all paths deduced
from urlconf.
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:4>
Comment (by julen):
Would it make sense to call `set_script_prefix()` in `ManagementUtility`'s
`execute()` method,
[https://github.com/django/django/blob/4dcc6493418c78db07761180bf6265f5b2bbccbf/django/core/management/__init__.py#L303
once settings have been configured]?
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:5>
Comment (by timgraham):
`django.setup()` seems to be a natural place for it.
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:6>
Comment (by julen):
I thought so initially, but this issue is limited to management commands,
that's why I wonder about `ManagementUtility.execute()`. Once the right
location for this is confirmed, the fix should be trivial.
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:7>
Comment (by timgraham):
I imagine it would also affect standalone scripts that invoke
`django.setup()` but don't use `ManagementUtility`.
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:8>
* needs_docs: 0 => 1
* has_patch: 0 => 1
* version: 1.3 => master
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:9>
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:10>
* type: Bug => New feature
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:11>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"7d81ee6efc385f7d4c1218639e4102c64495ba0f" 7d81ee6e]:
{{{
#!CommitTicketReference repository=""
revision="7d81ee6efc385f7d4c1218639e4102c64495ba0f"
Fixed #16734 -- Set script prefix even outside of requests
Thanks Tim Graham for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16734#comment:12>