Cocaine

What is Cocaine? It’s an open-source cloud platform enabling you to build your own PaaS clouds using simple yet effective dynamic components.

This documentation is for cocaine-framework-python.

More documentation

Features

  • Possibility to write cocaine workers
  • Wide support of asynchronous event-driven usage
  • Ready for usage with cloud services
  • Lots of examples included
  • Provided with cocaine-tools and embedded cocaine proxy
  • PyPy support

Quick example

Here’s some extremely useful Cocaine app written in Python:

#!/usr/bin/env python

from cocaine.worker import Worker
from cocaine.logger import Logger

log = Logger()

def echo(request, response):
    message = yield request.read()
    log.debug('Message received: \'{0}\'. Sending it back ...'.format(message))
    response.write(message)
    response.close()


W = Worker()
W.run({
    'ping': echo,
})