Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5887 closed defect (worksforme)

trac.cgi doesn't fully honor htdocs_location

Reported by: anonymous Owned by:
Priority: high Milestone:
Component: web frontend Version: 0.10.4
Severity: major Keywords: htdocs_location, URI, URL
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I'm running a trac 0.10.3 environment (from Debian Stable packages) configured like this (only relevant parts): apache2 conf:

	Alias /trac/ "/usr/share/trac/htdocs-sistemas/"

trac.ini:

[header_logo]
src = services.png

[trac]
htdocs_location = /trac/

Then, after an upgrade from 0.9.x to 0.10.3 and once properly upgraded environment and wiki I noted the header logo dissapeared. Trac logs show the following:

2007-08-16 14:59:45,645 Trac[__init__] WARNING: File services.png not found in any of ['/usr/share/trac/htdocs']
2007-08-16 14:59:45,645 Trac[__init__] WARNING: 404 Not Found (File services.png not found)

So instead of looking for the logo file at whatever /trac virtual directory points to (the logo is at /usr/share/trac/htdocs-sistemas/services.png) it looks for it at its (expected) default location at /usr/share/trac/htdocs.

Attachments (0)

Change History (7)

comment:1 by anonymous, 17 years ago

I forgot to mention I'm running Trac in "CGI mode".

comment:2 by anonymous, 17 years ago

Does it htdocs_location works at all?

Now I'm trying using mod_python, and no matter how I define htdocs_location I always get the same error (file services.png is the project logo and it *is* under the proper directory:

WARNING: File services.png not found in any of ['/usr/share/trac/htdocs']

trac.ini:

[trac]
(...)
htdocs_location = /htdocs

Of course mi server's /htdocs dir is not pointing to /usr/share/trac/htdocs.

What's happening? Is this a bug? Am I misunderstanding something?

in reply to:  2 ; comment:3 by Emmanuel Blot, 17 years ago

Replying to anonymous:

Of course mi server's /htdocs dir is not pointing to /usr/share/trac/htdocs. What's happening? Is this a bug? Am I misunderstanding something?

Well it should ;-)

Define htdocs_location to /trachtdocs for example, then add a rule in Apache so that it serves any request for /trachtdocs from /usr/share/trac/htdocs. This is usually achieved with an Alias directive.

in reply to:  3 comment:4 by anonymous, 17 years ago

Replying to eblot:

Replying to anonymous:

Of course mi server's /htdocs dir is not pointing to /usr/share/trac/htdocs. What's happening? Is this a bug? Am I misunderstanding something?

Well it should ;-)

Define htdocs_location to /trachtdocs for example, then add a rule in Apache so that it serves any request for /trachtdocs from /usr/share/trac/htdocs. This is usually achieved with an Alias directive.

That's exactly the point of it: From my understanding, static documents should be taken from wherever URL trac.ini's htdocs_location variable points to.

In my case, Apache is properly configured by means of an Alias to serve /htdocs from a different directory where in fact there's the missing icon.

So, Apache correctly maps this as intended:

/htdocs → /var/www/icons

But then, Trac maps this by its own:

/htdocs → /usr/share/trac/htdocs

If htdocs_location's purpouse is not delegating URL_to_filesystem mapping to Apache, what is it for? On the other hand, how can I tell Trac CGI what's the proper mapping so it points to whatever I want to instead of being fixed to /usr/share/trac/htdocs?

comment:5 by anonymous, 17 years ago

Component: generalweb frontend
Owner: Jonas Borgström removed
Priority: normalhigh
Severity: normalmajor

Having the same problem on 10.4

I wanted to write my own theme for trac, and that requires modification of trac.css and some images.

I changed the htdocs_location to point to my location, but trac still gets all the static files from default location (/usr/local/share/trac/htdocs).

I think this is definatly a bug.

Moreover, it would be logical to have all theme-related files (*.cs, *.css, *.phg, etc) in one directory, named after a theme name.

Right now everything is residing in 2 directories:

  • ./templates/
  • ./htdocs/

Would be much better to have a directory called "quicksilver" and all the files related to it stored in the directory, e.g.:

  • ./templates/ → ./themes/quicksilver/cs
  • ./htdocs/ → ./themes/quicksilver/htdocs

or like this:

  • ./templates/ → ./themes/_default_/cs
  • ./htdocs/ → ./themes/_default_/htdocs

or better yet:

  • ./templates/ → ./themes/_default_/<"templates" or "cs" or "chrome">
  • ./htdocs/css → ./themes/_default_/css
  • ./htdocs/*.png,*.gif,*.jpg → ./themes/_default_/images
  • ./htdocs/<the_rest> → ./themes/_default_/

This way, creating new themes would be much more straight forward.

comment:6 by anonymous, 17 years ago

Version: 0.10.30.10.4

in reply to:  5 comment:7 by Christian Boos, 17 years ago

Resolution: worksforme
Status: newclosed

Replying to anonymous:

Would be much better to have a directory called "quicksilver"

Actually at this point it should be called "kicksilver" ;-)
We're not supporting enhancements to ClearSilver engine and templates anymore in new versions of Trac and 0.10-stable at this point is mostly frozen.

This way, creating new themes would be much more straight forward.

See TH:ThemeEnginePlugin

Now, as for [trac] htdocs_location, it works perfectly, but of course you have to use it to map to a location, not to some place on the filesystem as it seems it was done in comment:4.

Example on this Trac (t.e.o):

[trac]
...
htdocs_location = http://www.edgewall.org/chrome/common11

If you're browsing this page using Firefox, you can select the View Page Info entry in the contextual menu, then look at the Links and Media tabs and you'll see that the images and other static resources come from there (ok, this is 0.11rc but it worked the same way for 0.10.x).

For reference: TracIni#trac-section, TracCgi#MappingStaticResources

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.