I finally figured out how to get mongrel2 + uwsgi + web2py running and I *definitely* need the final slash after the route.

mongrel2.conf exerpt:
...
    hosts = [
        Host(name="127.0.0.1", routes={
            '/tasks/static/': Dir(
                 base='./tasks/static/',
                 index_file='index.html',
                 default_ctype='text/plain'
              ),
            '/tasks/': Handler(send_spec='tcp://127.0.0.1:3033',
                    send_ident='54c6755b-9628-40a4-9a2e-cc82a816345e',
                    recv_spec='tcp://127.0.0.1:3032', recv_ident='',
                    protocol='tnetstring')
        })
    ]
...

Leave out the final slash in '/tasks/' and the request for http://localhost/tasks/edit/index will be taken by the static handler as per the mongrel2 documentation.

In my web2py code I throw away the useless PATH_INFO ( '/edit/index' or something similar ) and build the PATH_INFO and the QUERY_STRING from REQUEST_URI. QUERY_STRING is set to '' if there is no '?' in the request, (like mod_wsgi does), which web2py relies upon.

I suggest not setting the SCRIPT_NAME to the PATTERN (stripped of the final '/' or not). If you have parenthesis in your pattern you get that along as well.
SCRIPT_NAME in mod_wsgi is the empty string, just take that.

Take the full 'PATH' to set 'PATH_INFO' and parse.

Set QUERY_STRING to "" if QUERY is not found.

If I would need to leave out '/tasks' in my web2py handling I will do the url rewrite there. That is not the task of uWSGI interpreting what mongrel2 is not doing in the first place. I got the impression that the code in proto/zeromq.c is trying to do exactly that, but correct me if I am wrong.

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to