Re: Selecting a different config.py
will <[email protected]> Tue, 08 Jan 2008 11:04:59 -0500
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
The config.py file is a Python module and it's imported using regular
Python importing things.
At the top of the pyblosxom.cgi file that comes with 1.4.2 add the
following just below the "import os, sys" line:
sys.path.append( "/path/to/your/config.py/file" )
So if the config.py file I wanted to use was in
/home/willg/circus/config.py, I'd add the line:
sys.path.append( "/home/willg/circus/" )
So then you'd have different .cgi files--one for each blog you want to
run. Each one adds a different directory to the Python path which in
turn imports a different config.py file.
The other way to do it (and theoretically this works, but I haven't
tested it), is to name your config.py files differently and in each .cgi
file, change the line "from config import py as cfg". The "config" part
of that line is the module name. So if you had a config.py file that
was named "circusconfig.py", then you'd change the import line to:
from circusconfig import py as cfg
Hope that makes sense. I really apologize for not getting to this until
a year later.
/will
Chris G wrote:
> On Tue, Dec 25, 2007 at 04:54:35PM -0500, Sergey A. Lipnevich wrote:
>> Chris G wrote:
>>> In the pyblosxom.cgi script there is:-
>>>
>>> # this allows for a config.py override
>>> script = os.environ.get('SCRIPT_FILENAME', None)
>>> if script is not None:
>>> script = script[0:script.rfind("/")]
>>> sys.path.insert(0, script)
>>>
>>> Is this saying I can specify a different config.py (or a different
>>> name for it) by setting SCRIPT_FILENAME? If so, where do I set the
>>> SCRIPT_FILENAME variable so that it gets picked up when the CGI is
>>> run?
>> It's set by your CGI server and is usually a path to actual script file
>> that the server executed to process the request.
>> HTH,
>>
> That has confused me even more! :-)
>
> OK, my "CGI server" is presumably apache but I can't really see how
> that helps me. I could set things up so that apache will find a CGI
> file in a different place but that's not really what I want.
>
> What I want to do is to be able to specify a different config.py file
> somehow. Ideally I'd like to be able simply to use a different URL so
> that my exisitng:-
>
> http://home.isbd.net/cgi-bin/pyblosxom.cgi/
>
> takes me to my existing pyblosxom installation and one like:-
>
> http://home.isbd.net/cgi-bin/pyanother.cgi
>
> uses a different config.py and thus I can have an entirely independent
> set of pyblosxom files.
>
> Is this possible?
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace