Ben Bangert wrote:
>
> On Feb 9, 2006, at 6:44 PM, huydo wrote:
>
>> I have a catwalk like application (written in
pylons) I would like to
>> reuse in my other pylons apps ? what is the
recommended way to do this
>> taking in mind that I need to configure the model
for each
>> application I use it in.
>
> To pass the model config in, its best to use a config
pair in your
> config file, and use it in your application setup. Any
configuration
> for your [app:section] in the config file comes into
the
> config/middleware.py as a keyword arg. As an example,
in the PylonsHQ
> site, since I knew the docs directory might change that
was going to
> be used, I provided an option in the config file for
'doc_dir', then
> used it in the middleware file:
> http://pylonshq.com/project/pylonshq/
browser/pylonshq/trunk/development.ini
>
> http://pylonshq.com/pro
ject/pylonshq/browser/pylonshq/trunk/pylonshq/config/middlew
are.py
>
>
> The 'doc_dir' comes right into the middleware make_app
function.
> Alternatively, if you need to get to a configuration
option somewhere
> else, the entire dict of conf options is available
during run-time
> from paste, like so:
> from paste.deploy.config import CONFIG
> app_conf = CONFIG.current_conf()['app']
>
Thanks ben. Looking at your hella project, I saw this and am
using the
config like this.
> This is how the SQLObject database.py file that Pylons
comes with
> automatically picks out the sqlobject.dburi option from
the config file.
>
>> At the moment I am running it as a separate server
and i configure the
>> model appropriately depending on which model I want
to edit but I would
>> like tighter integration because of authorization,
css and all that
>> stuff.
>
> Using the config file, or mounting the other Pylons app
within the
> main one sort of does what you want. You can unify
authentication if
> its done in the middleware, or config file, the css
stuff is a little
> trickier. I'm going through right now trying some
different methods
> for a good solution and will get back shortly on this
aspect with more
> details.
>
I guess this is where I am a bit confused, probably because
I am so
unfamiliarly with paste.
Given two projects
/project1/development.ini
/project1/project1......
/project2/development.ini
/project2/project2
how do i mount project1 inside project2 ? Sorry if this is
OT and I'll
accept a "go RTM" if you would just point me to
which manual would be
relevant.
thanks
Huy
> Cheers,
> Ben
|