ildus/wsgid — comment on commit c05e9e19b7a85f491c7333cfa3d4fd86dcbacd9d
File:  line 0
By daltonmatos:

> When i request "/api/user/info.json", django can not resolve url, because PATH_INFO == /user/info.json in this time, but django need full path in PATH_INFO

I see. But I think this happens because the same prefix is mapped both on mongrel2 and on django. If you look closely the path `/api/user/info.json` is indeed not known by your app, since the _first_ part of the URI (`/api`) is part of the route known only by mongrel2. Have you tried accessing `/api/api/user/info.json`? I think this is where your django app is handling requests.

Since the mongrel2 route is `/api`, the `PATH_INFO` is all the remaining of the original accessed URL, that is, `/user/info.json`. I think you don't need to _re-map_ the `api` prefix. Think about plugging your django app as a _non-root_ app. If we wanted the `/myapp/api/user/info.json` to be valid, we would just attach our django app to a `/myapp` route in mongrel2 db. Here you are attaching your app to the `/api` route, so your django view is probably at `/api/api/user/info.json`.

Maybe your routes could be reduced to:

routes = {
'/': django_handler,
'/mf': django_handler,

This would have your django app in the root and the same django app under `/mf`.

I hope this helps. I already used wsgid and django apps as _non-root_ apps and it works fine, even using the `url` template tag to reconsrtruct internal django URIs.

Does all this make sense? =)