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.
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.pathfor fetching the corresponding view. According to the Django documentation,request.pathhas the full path, including the prefix, which causes the URL resolver to come up empty due to the unexpected prefix. Instead, it should userequest.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.