cubicweb/skeleton/cubicweb_CUBENAME/__init__.py.tmpl
author Denis Laxalde <denis.laxalde@logilab.fr>
Fri, 27 Jan 2017 11:05:07 +0100
changeset 11945 ef6b18c56b5a
parent 11454 7770559e3945
child 11968 bb0dfc7d2d0e
permissions -rw-r--r--
[skeleton] Add an entry point and configuration for running a Pyramid application We add a `pyramid_main` function in __init__.py that instantiate the WSGI application using "cubicweb.pyramid"; this is defined as an entry point (in setup.py) so that pserve_ can find it. Alongside comes a development.ini file which includes basic settings so that running a Pyramid+CubicWeb application works (only the "instance=<appid>" may be passed as a command-line argument). Logging is also configured there, but only includes the cube at stake and cubicweb (others could be added if needed). .. _perse: \ http://docs.pylonsproject.org/projects/pyramid/en/1.8-branch/pscripts/pserve.html

"""cubicweb-%(cubename)s application package

%(longdesc)s
"""


def pyramid_main(global_config, **settings):
    """Return a Pyramid WSGI application bound to a CubicWeb repository."""
    from pyramid.config import Configurator
    config = Configurator(settings=settings)
    config.include('cubicweb.pyramid')
    config.scan()
    return config.make_wsgi_app()