Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36998

Re: Forcing Python to detect DocumentRoot

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rodrick.brown@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'that?': 0.05; 'only,': 0.07; 'scripts': 0.09; 'python': 0.09; 'cc:addr:googlegroups.com': 0.09; 'forcing': 0.09; 'friday,': 0.09; 'path.': 0.09; 'cc:addr:python-list': 0.10; 'template': 0.11; 'charset:iso-8859-7': 0.15; 'helps.': 0.16; 'index.html': 0.16; 'roy': 0.16; 'wrote:': 0.17; 'detect': 0.17; 'thu,': 0.17; 'jan': 0.18; '>>>': 0.18; 'variable': 0.20; 'email addr:gmail.com&gt;': 0.20; 'trying': 0.21; 'import': 0.21; '&gt;&gt;&gt;': 0.22; '&gt;': 0.23; 'absolute': 0.23; 'user.': 0.23; 'seems': 0.23; 'linux': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'cc:2**2': 0.27; 'skip:& 60': 0.27; 'message- id:@mail.gmail.com': 0.27; 'post': 0.28; 'environment': 0.29; 'host.': 0.29; 'url:mailman': 0.29; 'probably': 0.29; 'folder': 0.30; 'framework': 0.30; 'relative': 0.30; 'code': 0.31; 'point': 0.31; 'you?': 0.32; 'url:python': 0.32; 'url:listinfo': 0.32; 'skip:d 20': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'exist': 0.35; 'path': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'page': 0.38; 'called': 0.39; 'url:mail': 0.40; 'back': 0.62; 'export': 0.62; 'details': 0.63; 'more': 0.63; 'within': 0.64; 'home': 0.66; 'smith': 0.71; 'article': 0.78; '2013': 0.84; 'itself?': 0.84; 'joel': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=U/nv77zxk/uaadZuJSi9Bjub/HkZTIIv1GNvZRAS7Nk=; b=ucobJPlIzE6+yb0DlaMJrDUDzUtvyJMVHJoiw82KMXLF0g/7b5JHOpROGllVl2Aqh8 GWZZj6fg+DFDwEcr7yYSx8RuikQjEyUbvK4eaiw9KGjezkiPnxZ/66qFHnosD95nE+pa K3qMskq9yhPeFlahSO7KQm6RkmcKm5bhJQfNPSTNsU2QU9P0WoCGuZ6VICIFYoR+4mj/ QYqxaFy2H/IoXslyuL/fXetQ6Y44OkLRwkHz5VsosT0DXtj6nY3wabOK0s1GrTucJuZi IORLIhJJ7nq1qcmwXw2CRgyfI1i7jMqwV1MkLaG05j+d7/f5ieZxvMPS76Nrl9hEQjFQ 33DQ==
MIME-Version 1.0
X-Received by 10.68.239.99 with SMTP id vr3mr5346725pbc.154.1358516507776; Fri, 18 Jan 2013 05:41:47 -0800 (PST)
In-Reply-To <10ebf68d-12f9-46d6-be50-6c314500302d@googlegroups.com>
References <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com> <roy-E9765E.09090217012013@news.panix.com> <mailman.590.1358435662.2939.python-list@python.org> <10ebf68d-12f9-46d6-be50-6c314500302d@googlegroups.com>
Date Fri, 18 Jan 2013 08:41:47 -0500
Subject Re: Forcing Python to detect DocumentRoot
From Rodrick Brown <rodrick.brown@gmail.com>
To Ferrous Cranus <nikos.gr33k@gmail.com>
Content-Type multipart/alternative; boundary=047d7b33d8d2de17da04d390459d
Cc Roy Smith <roy@panix.com>, "python-list@python.org" <python-list@python.org>, "comp.lang.python@googlegroups.com" <comp.lang.python@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.629.1358516516.2939.python-list@python.org> (permalink)
Lines 191
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358516516 news.xs4all.nl 6928 [2001:888:2000:d::a6]:59301
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36998

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Friday, January 18, 2013, Ferrous Cranus wrote:

> Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick
> έγραψε:
> > On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith <r...@panix.com<javascript:;>>
> wrote:
> >
> > In article <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com<javascript:;>
> >,
> >
> >
> >
> >  Ferrous Cranus <nikos...@gmail.com <javascript:;>> 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?
> >


$ export DOCUMENT_ROOT=${HOME}/public _html

Then from python os.environ['DOCUMENT_ROOT'] will have the relative path.

I hope this helps.


> >
> >
> > Can you give us more details of what you're doing.  Is there some web
> >
> > framework you're using?  Can you post some code that's not working for
> >
> > you?
> >
> > --
> >
> > http://mail.python.org/mailman/listinfo/python-list
> >
> >
> >
> > Import os
> >
> > Then read os.environ['HOME']
> >
> >
> > This will give you the home directory of the user.  in my case:
> >
> >
> > >>> os.environ['HOME']
> > '/home/jcg'
> > >>>
> >
> >
> > This is probably linux only, but that seems to be the environment you
> are working in .
>
> Yes my Python scripts exist in a linux web host.
>
> os.environ['HOME'] will indeed give the home directory of the user.
>
> to me /home/nikos/
>
> but i want a variable to point to
>
> /home/nikos/public_html whice is called DocumentRoot.
>
> is there avariable for that? i can't seem to find any...
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-16 05:51 -0800
  Re: Forcing Python to detect DocumentRoot Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-16 09:01 -0500
    Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-16 06:32 -0800
      Re: Forcing Python to detect DocumentRoot Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-16 09:39 -0500
    Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-16 06:32 -0800
  Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-17 01:03 -0800
  Re: Forcing Python to detect DocumentRoot rusi <rustompmody@gmail.com> - 2013-01-17 05:51 -0800
  Re: Forcing Python to detect DocumentRoot Roy Smith <roy@panix.com> - 2013-01-17 09:09 -0500
    Re: Forcing Python to detect DocumentRoot Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-17 10:14 -0500
      Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 05:02 -0800
        Re: Forcing Python to detect DocumentRoot Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-18 08:28 -0500
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 10:58 -0800
            Re: Forcing Python to detect DocumentRoot Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-18 14:11 -0500
            Re: Forcing Python to detect DocumentRoot Chris Angelico <rosuav@gmail.com> - 2013-01-19 08:34 +1100
              Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-19 00:01 -0800
                Re: Forcing Python to detect DocumentRoot Michael Torrie <torriem@gmail.com> - 2013-01-21 11:49 -0700
              Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-19 00:01 -0800
                Re: Forcing Python to detect DocumentRoot Piet van Oostrum <piet@vanoostrum.org> - 2013-01-19 21:01 +0100
                Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-20 22:25 -0800
                Re: Forcing Python to detect DocumentRoot Dave Angel <d@davea.name> - 2013-01-21 07:33 -0500
                Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-21 06:55 -0800
                Re: Forcing Python to detect DocumentRoot Michael Torrie <torriem@gmail.com> - 2013-01-21 11:42 -0700
                Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-21 06:55 -0800
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 10:58 -0800
        Re: Forcing Python to detect DocumentRoot Rodrick Brown <rodrick.brown@gmail.com> - 2013-01-18 08:41 -0500
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 12:49 -0800
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 12:49 -0800
        Re: Forcing Python to detect DocumentRoot Michael Torrie <torriem@gmail.com> - 2013-01-21 08:46 -0700
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-21 08:02 -0800
            Re: Forcing Python to detect DocumentRoot Michael Torrie <torriem@gmail.com> - 2013-01-21 11:36 -0700
          Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-21 08:02 -0800
            Re: Forcing Python to detect DocumentRoot Piet van Oostrum <piet@vanoostrum.org> - 2013-01-21 20:05 +0100
      Re: Forcing Python to detect DocumentRoot Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-18 05:02 -0800
  Re: Forcing Python to detect DocumentRoot Barry Scott <barry@barrys-emacs.org> - 2013-01-19 11:40 +0000
  Re: Forcing Python to detect DocumentRoot alex23 <wuwei23@gmail.com> - 2013-01-19 17:53 -0800

csiph-web