On Fri, May 20, 2011 at 8:54 PM, Gopalakrishnan S
<[email protected]> wrote:
> import pylons
> from paste.deploy import appconfig
> conf = appconfig('config:' + get_config_file(),
> relative_to=relative_path)
> load_environment(conf.global_conf, conf.local_conf)
Replace the last line with:
from my_pyramid_app import main
app = main(conf.global_conf, **conf.local_conf)
> import logging.config
> import os
> import paste.deploy.loadwsgi as loadwsgi
> ini_path = "/path/to/development.ini"
> logging.config.fileConfig(ini_path)
> app_dir, ini_file = os.path.split(ini_path)
> app = loadwsgi.loadapp("config:" + ini_file, relative_to=app_dir)
>
> So does this initialize pyramid as well? If it does, then I am done
> with that..The only difference I am seeing here is that in Pylons, we
> call load_environment where in pyramid it seems like calling
> loadwsgi.loadapp, hope this will not serve the app..
No, it works the same in both Pylons and Pyramid. The fundamental way
to instantiate a Pyramid application is to call the main() function.
In Pylons there are two levels. load_environment() initializes the
configuration level. make_app() in middleware.py instantiates a
PylonsApp and puts all the middleware around it. Pyramid doesn't have
this distinction: there's only the main() function which returns a
Pyramid application without middleware.
loadwsgi.loadapp() is a Paste wrapper around all this. It reads the
INI section and invokes the entry point indicated by the use= line.
The entry point points to make_app(), so this is just an indirect way
of calling make_app(). In Pyramid, the entry point points to the
main() function, so it's the same thing.
It will not serve the app by itself. You have to instantiate the
server by calling 'server= loadwsgi.loadserver(), and then call
'server(app)'.
--
Mike Orr <[email protected]>
--
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.