Forcing Python to detect DocumentRoot

Chris Angelico rosuav at gmail.com
Fri Jan 18 16:34:05 EST 2013


On Sat, Jan 19, 2013 at 5:58 AM, Ferrous Cranus <nikos.gr33k at gmail.com> wrote:
> Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:
>
>> DocumentRoot = os.environ['HOME'] + 'public_html'
>
> Yes, iam using this and it works.
> One last thing:
>
> my python script file is located at /home/nikos/public_html/addon_domain/cgi-bin/
>
> How python is able to run the following statement?
>
> f = open( '/home/nikos/public_html/' + page )
>
> which is clearly levels up of addon domain's DocumentRoot?

Time to take a step backward and figure out what you're really trying
to accomplish. I think, after gazing idly into my crystal ball for a
while, that you actually want to chroot your script - instead of
seeing "/home/nikos/public_html/" it would see just "/", and then it
can't access anything outside of that.

ChrisA



More information about the Python-list mailing list