nagare.publishers package

Submodules

nagare.publishers.common module

Base class of all the publishers

class nagare.publishers.common.Publisher

Bases: object

Base class of all the publishers

default_port = 8080
get_registered_applications()

Return all the applications registered on this publisher

on_new_process()

The publisher has started a new process

register_application(app_name, name, app, wsgi_pipe)

Register an application to launch

In:
  • app_name – name of the application
  • name – url of the application
  • app – the WSGI application
  • wsgi_pipe – the pipe of WSGI “middlewares”
register_static(name, get_file)

Register a WSGI application to serve static contents

In:
  • name – the URL of the contents will be prefix by /static/<name>/
  • get_file – function that will received the URL of the static content and will return its filename
Return:
  • URL prefix (/static/<name>/)
serve(filename, conf, error)

Run the publisher

In:
  • filename – the path to the configuration file
  • conf – the ConfigObj object, created from the configuration file
  • error – the function to call in case of configuration errors
spec = {}
nagare.publishers.common.serve_file(filename)

Create a WSGI application that return a static file

In:
  • filename – path of the file to serve
Return:
  • a WSGI application

nagare.publishers.eventlet_publisher module

nagare.publishers.fapws_publisher module

nagare.publishers.fcgi_publisher module

The FastCGI publisher

class nagare.publishers.fcgi_publisher.Publisher

Bases: nagare.publishers.common.Publisher, flup.server.fcgi_fork.WSGIServer

The FastCGI publisher

default_port = 9000
register_static(name, get_file)

Register a WSGI application to serve static contents

In:
  • name – the URL of the contents will be prefix by /static/<name>/
  • get_file – function that will received the URL of the static content and will return its filename
Return:
  • URL prefix (/static/<name>/)

Warning

Dummy method

The front HTTP server must be configurated to serve the static contents

(you can use the administrative command nagare-admin create-rules to generate the rewrite rules if you are using the lighttpd or nginx servers)

serve(filename, conf, error)

Run the publisher

In:
  • filename – the path to the configuration file
  • conf – the ConfigObj object, created from the configuration file
  • error – the function to call in case of configuration errors
spec = {'host': 'string(default=None)', 'maxChildren': 'integer(default=None)', 'maxRequests': 'integer(default=None)', 'maxSpare': 'integer(default=None)', 'minSpare': 'integer(default=None)', 'multiplexed': 'boolean(default=None)', 'port': 'integer(default=9000)', 'socket': 'string(default="")', 'umask': 'integer(default=None)'}

nagare.publishers.standalone_publisher module

The HTTP multi-threaded publisher

class nagare.publishers.standalone_publisher.Publisher

Bases: nagare.publishers.common.Publisher

The HTTP publisher

serve(filename, conf, error)

Run the publisher

In:
  • filename – the path to the configuration file
  • conf – the ConfigObj object, created from the configuration file
  • error – the function to call in case of configuration errors
server_spec = {'daemon_threads': 'boolean(default=None)', 'host': 'string(default=None)', 'port': 'integer(default=None)', 'protocol_version': 'string(default=None)', 'server_version': 'string(default=None)', 'socket_timeout': 'integer(default=None)', 'threadpool_workers': 'integer(default=None)', 'use_threadpool': 'boolean(default=None)'}
spec = {'daemon_threads': 'boolean(default=None)', 'dying_limit': 'integer(default=None)', 'host': 'string(default=None)', 'hung_check_period': 'integer(default=None)', 'hung_thread_limit': 'integer(default=None)', 'kill_thread_limit': 'integer(default=None)', 'max_requests': 'integer(default=None)', 'max_zombie_threads_before_die': 'integer(default=None)', 'port': 'integer(default=None)', 'protocol_version': 'string(default=None)', 'server_version': 'string(default=None)', 'socket_timeout': 'integer(default=None)', 'spawn_if_under': 'integer(default=None)', 'threadpool_workers': 'integer(default=None)', 'use_threadpool': 'boolean(default=None)'}
threadpool_spec = {'dying_limit': 'integer(default=None)', 'hung_check_period': 'integer(default=None)', 'hung_thread_limit': 'integer(default=None)', 'kill_thread_limit': 'integer(default=None)', 'max_requests': 'integer(default=None)', 'max_zombie_threads_before_die': 'integer(default=None)', 'spawn_if_under': 'integer(default=None)'}

Module contents