A PasteDeploy binding to the plaster configuration loader.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/plaster_pastedeploy
tests keep existing loggers when invoking setup_logging Jul 11, 2018
.coveragerc fix coverage Mar 30, 2017
.gitignore
.travis.yml add linting for the manifest and readme Jun 29, 2017
CHANGES.rst prep 0.6 Jul 11, 2018
CONTRIBUTING.rst add a note about signing CONTRIBUTORS.txt Jun 12, 2017
CONTRIBUTORS.txt Sign CONTRIBUTORS.txt Nov 17, 2017
LICENSE.txt prep 0.1 Mar 28, 2017
MANIFEST.in
README.rst remove env-var support Mar 29, 2018
appveyor.yml add appveyor.yml Mar 28, 2017
setup.cfg update manifest linting rules Jun 29, 2017
setup.py prep 0.6 Jul 11, 2018
tox.ini

README.rst

plaster_pastedeploy

plaster_pastedeploy is a plaster plugin that provides a plaster.Loader that can parse ini files according to the standard set by PasteDeploy. It supports the wsgi plaster protocol, implementing the plaster.protocols.IWSGIProtocol interface.

Usage

Applications should use plaster_pastedeploy to load settings from named sections in a configuration source (usually a file).

  • Please look at the documentation for plaster on how to integrate this loader into your application.
  • Please look at the documentation for PasteDeploy on the specifics of the supported INI file format.

Most applications will want to use plaster.get_loader(uri, protocols=['wsgi']) to get this loader. It then exposes get_wsgi_app, get_wsgi_app_settings, get_wsgi_filter and get_wsgi_server.

import plaster

loader = plaster.get_loader('development.ini', protocols=['wsgi'])
# to get any section out of the config file
settings = loader.get_settings('app:main')

# to get settings for a WSGI app
app_config = loader.get_wsgi_app_settings()  # defaults to main

# to get an actual WSGI app
app = loader.get_wsgi_app()  # defaults to main

# to get a filter and compose it with an app
filter = loader.get_wsgi_filter('filt')
app = filter(app)

# to get a WSGI server
server = loader.get_wsgi_server()  # defaults to main

# to start the WSGI server
server(app)

Any plaster.PlasterURL options are forwarded as defaults to the loader. Some examples are below:

  • development.ini#myapp
  • development.ini?http_port=8080#main
  • pastedeploy+ini:///path/to/development.ini
  • pastedeploy+ini://development.ini#foo
  • egg:MyApp?debug=false#foo