[Trac] mod_python and colored diffs

Matthew Gillen mgillen at bbn.com
Fri Jun 10 11:44:36 CDT 2005


Matthew Gillen wrote:

>Emmanuel-G BLOT wrote:
>
>  
>
>>Matthew Gillen wrote:
>>
>>    
>>
>>>Hi,
>>>I'm using Apache+mod_python to run Trac, and the diffs are not colored.
>>> If I use 'tracd' to run Trac, I get colored diffs no problem.  So I'm
>>>thinking there must be something screwy in my apache config (ie it can't
>>>run enscript or something).
>>>      
>>>
>>Might be a CSS issue. Did you check that the diff.css was available to
>>your web client ?
>> * Go to the erroneous diff page
>> * Look at the HTML source. In the header, you'll find something like
>>    <link rel="stylesheet" href="/trac/css/diff.css" type="text/css" />
>> * Create a new URL and ask the web client to load it:
>>http://server/<href> in the above line, e.g. from the above example
>>http://server/trac/css/diff.css
>>
>>If the web client cannot load this page, you probably have a trouble
>>with your Apache configuration file.
>>
>>    
>>
>I think you're on to something:
>The erroneous diff page has this code in the header:
>
><style type="text/css">
>   @import url(/trac/css/trac.css);
>   @import url(/trac/css/changeset.css);
>
>Now bringing up 'http://hostname/trac/css/trac.css' shows the contents
>of the css file, as expected.  However, replacing changeset.css for
>trac.css brings me to the top-level start page (ie project listing; just
>like any malformed URL that trac can't figure out).  Interestingly, the
>diff.css seems ok (ie just like trac.css).
>
>There's nothing in Apache's errorlog about file not found or anything.
>So, I think you're right, but I'm not real sure where to go from here...
>Thanks,
>Matt
>  
>
Ok, I think I fixed it.  Basically I think my apache directives were
confusing it.  My original directives were:
-------------------------
Alias /trac/ /usr/share/trac/htdocs/
<Directory "/usr/share/trac/htdocs">
 Options Indexes MultiViews
 AllowOverride None
 Order allow,deny
 Allow from all
</Directory>

<Location /trac>
   SetHandler mod_python
   PythonHandler trac.ModPythonHandler
   PythonOption TracUriRoot "/trac"
   PythonOption TracEnvParentDir /path/to/trac/
</Location>
-------------------------
Notice how there is an Alias directive for /trac, but also a Location
directive.  If I change the Location and TracUriRoot to something
slightly different, everything seems to magically work:
-------------------------
<Location /tracsrv>
...
   PythonOption TracUriRoot "/tracsrv"
...
</Location>

--Matt




More information about the Trac mailing list