<div class="gmail_quote">Hi, I'm deploying my Pylons application on Nginx using uwsgi, and I'm trying to set an empty SCRIPT_NAME because otherwise my Pylons application prepends an extra / in front of all non-absolute URLs.<div>
<br></div>
<div>Here is the relevant part of the configuration:</div><div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>server {</div></div><div> ...</div>
<div><br></div><div><div> location / {</div></div><div><div> root /var/lib/wsgi/;</div></div><div><div> uwsgi_pass unix:///tmp/uwsgi.sock;</div></div><div><div> uwsgi_param UWSGI_SCRIPT wsgi;</div>
</div><div><div> uwsgi_param SCRIPT_NAME /;</div></div><div><div> include uwsgi_params;</div></div><div><div> }</div></div><div><div>}</div></div></blockquote><div><br></div><div>
When I try to remove the SCRIPT_NAME param or set it to SCRIPT_NAME "";, Nginx stops serving the app with this error: "wsgi application not found"</div><div><br></div><div>Right now, with the extra / it works fine but I have to perform a nasty hack in my wsgi Oython application container:</div>
<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>from paste.deploy import loadapp</div></div><div><div><br></div></div><div><div>actual_application = loadapp('config:/var/lib/wsgi/src/path/to/my.ini')</div>
</div><div><div><br></div></div><div><div>def wrapper_application(environ, start_response):</div></div><div><div> if environ["SCRIPT_NAME"] == "/":</div></div><div><div> environ["SCRIPT_NAME"] = ""</div>
</div><div><div> return actual_application(environ, start_response)</div></div><div><div><br></div></div><div><div>application = wrapper_application</div></div></blockquote><div><br></div><div>The uwsgi command running within supervisord:</div>
<div><br></div><div>/usr/bin/uwsgi --pidfile /var/run/uwsgi.pid -s /tmp/uwsgi.sock -C -M 4 -A 4 -m -H /var/lib/wsgi/ --pythonpath /var/lib/wsgi --uid 33 --gid 33 -L</div><div><br></div><div>Versions:</div><div><br></div>
<div>
nginx-0.7.65</div><div>uwsgi-0.9.5</div><div>python-2.6.5</div><div><br></div><div>Is there any way to set an empty SCRIPT_NAME in the uwsgi nginx configuration? Am I missing something?</div><div><br></div><div>Thank you in advance!</div>
<div><br></div><font color="#888888"><div>- Andrey</div>
</font></div><br>