LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   CGI/Perl/Python (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=22)
-   -   Django, LiteSpeed Context / External App Config, and PATH_INFO (http://www.litespeedtech.com/support/forum/showthread.php?t=1698)

danofames 01-22-2008 12:43 AM

Django, LiteSpeed Context / External App Config, and PATH_INFO
 
First, I'm just getting started with LiteSpeed and enjoying the experience so far.

I was able to get a Django application running by setting up the External App, and Context for '/' as described in these forums.

When I did so, and tried to access the root of the site, http://mysite.com/, there would be an error similar to the one described in this ticket:
http://code.djangoproject.com/ticket/3414

Looking through the debug information, the PATH_INFO variable was not getting through to Django. One of the fixes on the ticket checks whether or not it is set, and if it's not, sets the an internal path variable to '/'. The error went away after applying that patch.

I have no idea if this is an issue with LiteSpeed or Django, but I was curious if there was a setting in LiteSpeed that may be affecting the lack of PATH_INFO in Python's implementation of FastCGI. Nothing was apparent while poking around, so I'm assuming it's a quirk of the FastCGI libraries or Django's code, but I wanted to see if I could get more information.

Thanks,
dc

mistwang 01-22-2008 10:30 AM

Thanks for the update.
Since there is no standard way to set PATH_INFO environment variable, some server set it for some application, some servers do not. The best way to fix it is to test PATH_INFO env in Python and set it to the desirable value if missing.

danofames 01-23-2008 06:56 AM

an approach that seems to work and doesn't involve changing Django core files is adding a middleware request class something like this:

Code:

class SetEmptyPathInfo(object):
    def process_request(self, request):
        if not request.path:
            request.META['PATH_INFO'] = '/'
            request.path = '/'



All times are GMT -7. The time now is 09:05 PM.