Skip to content

The no_logging decorator does not work when the root URL for the site is a subpath instead of the host #147

@BurningLights

Description

@BurningLights

For instance, if the site is hosted at www.example.com/example rather than www.example.com, the logging modifications applied with no_logging do not work. The cause is at line 181 of middleware.py in the _get_func method. It uses request.path for fetching the corresponding view. According to the Django documentation, request.path has the full path, including the prefix, which causes the URL resolver to come up empty due to the unexpected prefix. Instead, it should use request.path_info, which strips away the prefix and leaves only the portion of the path actually used to resolve URLs. I have tested it, and this change fixes the issue. I can submit a pull request if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions