hgwedir wsgi

Yves Dorfsman yves at zioup.com
Tue Feb 10 09:09:00 CST 2009


Paul Fisher wrote:
> Yves Dorfsman wrote, On 18/01/09 09:52 AM:
>> I'm trying to run the wsgi script through apache, but am running into an 
>> issue, all I get is:
>>
>> "Premature end of script headers"
>>
>> in the error log. If I add:
>> print "Content-Type: text/html\n\n"
>> print "<html><body>hello<BR></body></html>"
>>
>> To the function, theb I no longer get an error, but all it says is hello... 
>> How does one go about to debug something like this ?
> 
> It looks to me like your server isn't running the script as a WSGI
> application, but just as a CGI script.  Are you sure mod_wsgi is enabled
> and is configured to execute hgweb?

Thanks. Indeed it was an apache configuration problem, I had put "AddHAndler 
cgi-script .wsgi" instead of "AddHandler wsgi-script .wsgi".

Now, I still had to modify hgwebdir to make it work with repos containing a 
hgrc file, I had to add:

sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__

at the top of my wsgi file. After I digged a lot, I found a few of blogs and 
bug report describing this. Is this fix in the newer versions (I am running 
1.1.2), or should it be added to the default hgwebdir.wsgi ?

-- 
Yves.
http://www.sollers.ca/



More information about the Mercurial mailing list