Is there a way to alter the request.path before matching the urls?
问题 When I get a request for a path that includes the word 'self' I want to replace it with the user id before matching it to a URL. I tried using a middleware like this: def process_request(self, request): if '/self/' in request.path: request.path = request.path.replace('/self/','/' + str(request.user.id) + '/') The replacement works but apparently is done after the URL matching. Is there any way to alter the path before this point? 回答1: Apparently, the URL marching is not done using request