On May 15, 2:36 pm, Yonggang Luo <[email protected]> wrote:
> for exmaple
> [trac]
> htdocs_location=D:\trac\htdocs
> is this meaning full?
>
> or
> [trac]
> htdocs_location=www.site.com/htdocs
>
> Also
> how Did I access htdocs_location
>
> For example, I want to access the resource of $(htdocs_location)/
> image.png
> what's the trac usl?
> did that looks like this?
>
> trac.wsgi/project_name/chrome/site/image.png
> or
> trac.wsgi/project_name/chrome/common/image.png
> ?
>
You've touched on a setting that is not at all working according to
its intention. The intention back when it was created (a long time
ago) was to provide a simple way to statically serve the Trac
graphics, js and css files. So, typically if you put it somewhere in
your Apache DocumentRoot it would perhaps be available at /trac-htdocs/
*. To tell Trac to make references to this location instead, you would
then set htdocs_location = /htdocs. Instead of /projects/myenv/chrome/
common/trac.png Trac will render the source location of the image as /
htdocs/trac.png. So far so good.
I believe the setting predates the plugin architecture introduced with
0.9. With 0.9, you got plugins adding to the chrome namespace in Trac.
As htdocs_location is hardwired to replace chrome/common, plugins
can't be included and would keep making references such as chrome/
fullblog/file.png. With 0.11 the "trac-admin $env deploy" command was
created, that neatly exports all the Trac and plugin and site chrome
so that it can be easily served as static files. However, only the
common (Trac) chrome is supported for internal rewrite which greatly
limits its usefulness.
So I, and likely all others that tune the static serving of files, end
up using standard apache rewrite engine to remap calls to chrome/* to
instead be direct this at the base location where I serve static
files. One note: If you serve projects using a parent directory, you
want your chrome/site to be excluded from this rewrite as many
projects can't map to same location on disk.
Anyway, I've left the htdocs_location setting empty. It is a shame,
and there is an open ticket for this (I remember working on it...).
With the next major release we should really try to fix this so that
Trac itself could render correct links as needed by moving the
reference level one step up - and allowing all plugins to migrate to
using ${htdocs_location} as base instead of ${href.chrome()}.
:::simon
https://www.coderesort.com
http://www.ohloh.net/accounts/osimons
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en.