Code Painters The Art of Coding

5Aug/121

WSGI deployment under a subpath using uWSGI and Nginx

It's relatively obvious how to deploy a WSGI application using Nginx, and there are many tutorials out there dealing with this very task. It took me quite a few minutes, however, to figure out how to deploy the application under non-root URL, e.g. http://some.site.com/admin/.

This is typically dealt with by configuring the SCRIPT_NAME CGI parameter, and letting this name be removed from the beginning of the PATH_INFO parameter by the WSGI environment, before the path is passed down to the application. This way the WSGI application routing remains the same, no matter where in the URL tree it is deployed. The application needs to be aware of SCRIPT_NAME parameter only to generate proper URLs to self. Continue reading…

Tagged as: , , , 1 Comment