Hi,
for starters: former pylons user - liked bfg  - so obvioulsy went with
pyramids for my current project..

The setup:
i have decided to use a composite app "architecture" - besically
virtual hosting as explained here (http://docs.pylonsproject.org/
projects/pyramid/1.0/narr/vhosting.html). example:

main web site (pyramid/wsgi app): http://example.com/
admin website  (pyramid/wsgi app): http://example.com/admin/

my development.ini file is something like this:


[DEFAULT]
..
[composite:main]
use = egg:Paste#urlmap
/ = web
/admin = admin

[app:web]
use = egg:Example#main
jinja2.directories = example:templates/web

[app:admin]
use = egg:Example#admin
jinja2.directories = example:templates/admin
...

I then create 2 configurators - 1 for each app like this (not yet
refactored..):

def main(global_config, **settings):
    config = Configurator(root_factory=root_factory,
settings=settings)
    config.add_renderer('.html', pyramid_jinja2.renderer_factory)
    config.scan()
    return config.make_wsgi_app()

def admin(global_config, **settings):
    config = Configurator(root_factory=root_factory,
settings=settings)
    config.add_renderer('.html', pyramid_jinja2.renderer_factory)
    config.scan()
    return config.make_wsgi_app()

example views:
#website
@view_config(renderer='home.html') #home.html in templates/web/
home.html
def index(context, request):
   return {'what': 'website'}

#admin
@view_config(renderer='home.html') #home.html in templates/admin/
home.html
def index(context, request):
   return {'what': 'admin'}

The problem/questions:

-Notice that i have specified different values for jinja2.directories
- however, the jinja2.directories value for the web app (main) is
replaced/crushed by the jinja2.directories value of the admin app
(admin) obviously because the admin app is created last. Why is this
happening - yet i created 2 different configurators - 1 for each app
(i don't want to suggest reasons since i'm yet to grasp pyramid's
internals.. but i guess something is being shared.. app registry
maybe??).

-Is this the way to go when creating virtual/composite apps with
pyramid.. eg. creating a configurator for each app, etc.. - just
wondering because app specific configs in the .ini file seem to be
crushed so maybe am  missing something here..
Other than the above problems/uncertainties View lookup is pretty
straight forward since am using zope interfaces + the view_config
params: context and containment.

Any response/enlightening will be hight apreciated.

Regards,
Eric


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to