Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make toolbar compatible with FORCE_SCRIPT_NAME #1970

Merged
merged 2 commits into from
Jul 26, 2024

Commits on Jul 22, 2024

  1. Make toolbar compatible with FORCE_SCRIPT_NAME

    Previously, if a project used the `FORCE_SCRIPT_NAME` setting (common when
    hosting a Django application on a subdirectory path via a reverse proxy),
    the `django.urls.resolve()` call would always raise `Resolver404` in the
    middleware. As a result, `is_toolbar_request()` always returned False.
    
    This caused internal toolbar URLs to be inspected, and also indirectly
    led to a request loop when refreshing the history panel.
    
    In most cases (if `FORCE_SCRIPT_NAME` is unset), `get_script_prefix()` will
    return "/" and the `replace()` will be a no-op.
    dmartin committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    e628c91 View commit details
    Browse the repository at this point in the history
  2. Use path_info when resolving requests

    Maintains support for `SCRIPT_NAME` without manually calling
    `get_script_prefix()`.
    
    Tests that involved manually setting the `path` attribute of a request
    have been reworked to use a `RequestFactory` so that the `path` and
    `path_info` attributes are both set appropriately.
    dmartin committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    fb354f1 View commit details
    Browse the repository at this point in the history