def main(global_config, **settings):
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
config = Configurator(settings=settings)
config.set_root_factory(RootFactory)
config.set_session_factory(SignedCookieSessionFactory('...'))
config.include('myapp')
config.include('pyramid_mako')
config.include('pyramid_chameleon')
config.add_static_view('deform_static', 'deform:static')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
# Add all other routes here...
config.scan()
return config.make_wsgi_app()
def includeme(config):
authz_policy = ACLAuthorizationPolicy()
config.set_authorization_policy(authz_policy)
authn_policy = AuthTktAuthenticationPolicy('...', hashalg='sha512')
config.set_authentication_policy(authn_policy)
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.
I've tried to make the distinction between what is my package as a component and what is my package as an application.
So most of my stuff is in includeme, but my root factory config, a status check route, and a favicon route are in main.
On Tue, Dec 16, 2014, 07:51 Michael Merickel <mmer...@gmail.com> wrote:
On Tue, Dec 16, 2014 at 5:48 AM, pyramidX <veeruk...@hotmail.com> wrote:
> I've seen includeme used in some examples of writing pyramid tests, but I'm
> still not sure. If the idea is to allow tests to have a lot of the context
> of the regular app, then shouldn't I instead move most of the lines from
> main to includeme and allow tests to call "config.include('myapp')"? In this
> case main would just basically return config.make_wsgi_app() after calling
> includeme?
Yep, this is the approach that I take in my apps. The majority of your
app's configuration should go into includeme functions as this is a probably
the best point of modularity within your pyramid structure. You
can include certain features and not include others in tests based on
things like this.
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
What is the difference between component vs application in the way you define it just wondering?