Thanks Michael!
It's worth noting that the last pyramid app created, isn't actually
determined from the order in the .ini file. Since it ultimately serializes
to a dictionary {(domain, path): loader, ...} and we all know and love the
unordered natured of Python dicts.
-C
On Wednesday, July 22, 2015 at 4:53:40 PM UTC-4, Michael Merickel wrote:
>
> Pyramid has no way to know which pyramid app you are referring to in
> bootstrap unless you specify the section. As pyramid at a fundamental
> level supports running multiple apps in the same process you have to
> handle this yourself outside if you need to load a specific app for
> your script to run.
>
> The config_uri supports specifying the section without your patch. You
> just do bootstrap('development.ini#project'). By default it uses main
> of course, and after that it falls back to loading "the last pyramid
> app created" logic which is what's finding your support app right now.
> If this isn't working for you then you should be specifying the
> section in your scripts.
>
> On Wed, Jul 22, 2015 at 2:09 PM, Chip Kellam <[email protected] <javascript:>>
> wrote:
> > I have defined my config.ini file as such using the paste urlmap
> guidelines
> > for creating this type of application:
> >
> > [composite:main]
> > use = egg:Paste#urlmap
> > / = project
> > domain developer.domain.com / = dev
> > domain support.domain.internal / = support # Internal/VPN-only URL
> >
> > [app:project]
> > use = egg:project
> >
> > [app:dev]
> > paste.app_factory = dev:main
> >
> > [app:support]
> > paste.app_factory = support:main
> >
> >
> > "support" is a new module we just wrote to allow our CSRs to manage data
> > through a CRUD-style interface. However, when I added this 3rd app
> ("dev"
> > has been there for a while), Pyramid now bootstraps that app in console
> > scripts INSTEAD of "project". I can tell because when I run: proutes
> > config.ini, I see the "support" routes and NOT the "project" routes.
> >
> > I'm using the standard:
> >
> > from pyramid.paster import bootstrap
> > env = bootstrap(config_uri)
> >
> > I did notice if I monkey patch bootstrap and pass in the app name I
> want, it
> > works fine, e.g:
> >
> > def bootstrap(config_uri, request=None, options=None, name='main'):
> > app = get_app(config_uri, name=name)
> > env = prepare(request)
> > env['app'] = app
> > return env
> >
> >
> > Any idea why this would be occurring?? I'd rather not do anything hacky
> > with the core pyramid code, but this is affecting all of the logic in
> our
> > scripts that deal with any custom app configurations.
> >
> > Thanks for your help!
> >
> > -Chip
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "pylons-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > Visit this group at http://groups.google.com/group/pylons-devel.
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.