Unicorn, Gunicorn, Rack, WSGI, etc

  • unicorn - 独角兽
require 'rack'

handler = Rack::Handler::Thin

class RackApp
  def call(env)
    [200, {"Content-Type" => "text/plain"}, "Hello from Rack"]
  end
end

handler.run RackApp.new

Gunicorn - Python WSGI HTTP Server for UNIX

  • https://gunicorn.org/
pip install gunicorn

A simple WSGI demo:

def app(environ, start_response):
    data = b"Hello from WSGI"
    start_response("200 OK", [
        ("Content-Type", "text/plain"),
        ("Content-Length", str(len(data)))
    ])
    return iter([data])

uWSGI

  • https://github.com/unbit/uwsgi/

application server for python/WSGI, ruby/Rack, perl/PSGI, etc.