Forcing Python to detect DocumentRoot

alex23 wuwei23 at gmail.com
Sun Jan 20 02:53:20 CET 2013


On Jan 16, 11:51 pm, Ferrous Cranus <nikos.gr... at gmail.com> wrote:
> When trying to open an html template within Python script i use a relative path to say go one folder back and open index.html
>
> f = open( '../' + page )
>
> How to say the same thing in an absolute way by forcing Python to detect DocumentRoot by itself?

The main ways we handle something like this are:

1. Set an environment variable that Python then reads to get the
DocumentRoot value.
2. Use something like zc.buildout to produce both your httpd.conf and
create a config file containing the value of DocumentRoot.



More information about the Python-list mailing list