I'm sure others will say something different, but my approach has
always been to simply run multiple apps on separate subdomains.
Subdomains are free ;) In the past, I had login.foxmarks.com,
my.foxmarks.com, and www.foxmarks.com. Each of the apps were
completely separate, but I used Genshi to create a common look and
feel.
-jj
--
I, for one, welcome our new Facebook overlords!
http://jjinux.blogspot.com/
No: the way pylons is setup it will only look for controllers and
templates in a single package. That is not terribly hard to fix but I'm
not sure if that is a design goal for pylons.
Wichert.
--
Wichert Akkerman <wic...@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
Because your add-ons may want to do things like add a new controller,
replace a template, etc.
You can make a Pylons application for each component, and then tie
them into the parent app via a pseudo-controller. (I.e., replace the
controller class with your WSGI app instance, but keep the controller
name.) Set full_stack=False in the subapplication; you may also want
to comment out the error middleware. I haven't seen anyone do it but
it theoretically should work. You may have to a little bit to pass
the config dict.
--
Mike Orr <slugg...@gmail.com>
from myinnerapp.config.middleware import make_app
OuterController = make_app(config["global_conf"], full_stack=False,
**config["app_conf"])
This would push another config onto of pylons.config, but since it's
the same as the parent's config that shouldn't make a difference.
As for the other middleware changes, I was misremembering. The error
middlewares are already under "if asbool(full_stack)". What I had
suggested earlier was that SessionMiddleware and CacheMiddleware also
belong under that 'if' so that the outermost one is used.
RoutesMiddleware, I'm not sure (see below).
On Sat, May 24, 2008 at 12:44 PM, Jonathan Vanasco
<jona...@findmeon.com> wrote:
>
> I *really* like how the modular approach can compartmentalize the
> necessary templates and controllers.
>
> I intensely dislike how the modular approach compartmentalizes the
> routing and model. If something is affecting the routing & model,
> IMHO, it's not a plugin - its a standalone app.
Well, it affects the routing only in the sense that the subapp parses
the rest of the URL -- as it should. If the route is defined as
/subapp/*path_info (a magic name), this should set up PATH_INFO for
the subapp. On the other hand, I'm not sure whether you can nest
RouteMiddlewares and RouteMaps or not. How would url_for know which
set of routes to choose? It just takes somebody to do this and figure
out what works. (The Routes 2 structure I have in mind should help
with this. The middleware puts a request-specific URL generator in
the WSGI environ, which Pylons mounts onto 'pylons.url' -- a
StackedObjectProxy like pylons.request. This should allow the inner
app to see its own URL generator, and the outer app its own.)
As for the model, I forgot about that. That is a bit of a hassle, to
get multiple models to share the same database and connection pool.
Which just means we have to figure out the right standard
configuration for it. One way would be for the top-level
environment.py to set up the engine as normal and then call the
subapp's init_model(). Another way would be for the top
environment.py to initialize its own model, then put the engine in the
config for the subapp to use. That means the subapp would have to
anticpate this happening, though it could check for an engine object
first, and if none was there create its own engine.
> The design we're running with right now... is a core model/
> controller/lib which the main Pylons app inherits.
It will be interesting to see this structure. Certainly, the
controller does not have to use the global templates directory or
render method; if it uses its own templates stored its own way, that
works too.
But then that gets into the issue of the site template. If the inner
app should be shown within the global header and sidebar, then you'd
have to inherit the site template -- which doesn't work well across
apps, plus you'd have to know what variables to set for the site
template. Or the outer app could have a controller ACTION (not a
whole controller) that calls the inner app to get the page content,
and then plugs that into its template. The action could emulate a
WSGI server, possibly using WebOb's application-wrapper for
convenience.
I definitely think there's a huge potential for autonomous Pylons app
components, if we can just figure out the details. Then you could
plug a Pylons wiki or calendar or shopping cart or ticket manager into
a Pylons app in five minutes.
--
Mike Orr <slugg...@gmail.com>
If these are in fact separate applications, you can make each one its
own Pylons app. Then you might also have a common package of code
shared between all three (this would be a separate egg).
Then at deployment time you can combine them into one composite
application with Paste URL map, via the ini file:
http://pythonpaste.org/deploy/#composite-applications
--
Philip Jenvey
> But then that gets into the issue of the site template. If the inner
> app should be shown within the global header and sidebar, then you'd
> have to inherit the site template -- which doesn't work well across
> apps, plus you'd have to know what variables to set for the site
> template. Or the outer app could have a controller ACTION (not a
> whole controller) that calls the inner app to get the page content,
> and then plugs that into its template. The action could emulate a
> WSGI server, possibly using WebOb's application-wrapper for
> convenience.
Long ago the topic of portlet-style sites came up on this list and Ian
suggested using a subrequest and paste.recursive. Wouldn't a web helper
that could do a subrequest be a possible solution? Rather than the
plugin inheriting the site template, the site template would perform a
subrequest to retrieve the plugin's html.
Regards,
Cliff
It could. I'm not really a fan of subrequests, seems like a lot of
overhead. But in some cases it may be the simplest solution.
--
Mike Orr <slugg...@gmail.com>
As I understand it, paste.recursive turns local subrequests into a
function call(s) rather than actually making another HTTP request. So
there will undoubtedly be a small amount of additional overhead, but not
as much as a full subrequest would normally incur.
Cliff