On Jan 12, 2014 6:27 PM, "Denis Papathanasiou" < [email protected]> wrote: > > I'm confused about the internal routing options explained here: http://uwsgi-docs.readthedocs.org/en/latest/InternalRouting.html > > I'm running uwsgi with this ini file: > > [uwsgi] > socket = localhost:9090 > wsgi-file = my_wsgi_server.py > processes = 4 > threads = 2 > > > and where my_wsgi_server.py has a function called "application", which takes an env and start_response parameter, as described in the python quickstart guide: http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html > > What I want to do is define a "verifyapp" function in the my_wsgi_server.py file, and route to it all url requests which begin with /verify, where the "verifyapp" function looks like this: > > def verifyapp(env, start_response): > start_response('200 OK', [('Content-Type','text/html')]) > return ["Hello World"] > > I've tried this line in the ini file: > > route = ^/verify uwsgi:,0,0,verifyapp > > But it seems to ignore those requests, and it passes everything to "application" instead. > > When I try changing it to this instead: > > route = ^/verify uwsgi:localhost:9090,0,0,verifyapp > > I get a server error: > > error routing request to uwsgi server localhost:9090 > > So how do I use internal routing?
Internal routing routes to a mountpoint/UWSGI_APPID/application, not a callable. You need something that looks like this (unverified): mount=vapp=my_wsgi_server:verifyapp route=^/verify uwsgi:,,,vapp ...I used "vapp" to demonstrate a mountpoint is just an arbitrary string, but if not explicitly routed (IIRC) it will match the PATH_INFO CGI variable as well. -- C Anthony [mobile]
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
