v. 1.21.0


To run apps built with the Responder web framework using Unit:

  1. Install Unit with a Python 3.6+ language module.

  2. Create a virtual environment to install Responder’s PIP package:

    $ cd /path/to/app/
    $ python3 -m venv venv
    $ source venv/bin/activate
    $ pip install responder
    $ deactivate
  3. Let’s try a Unit-friendly version of a tutorial app, saving it as /path/to/app/

    import responder
    app = responder.API()
    def hello_world(req, resp):
        resp.text = "Hello, World!"
    def hello_to(req, resp, *, who):
        resp.text = f"Hello, {who}!"

    The call is omitted because app will be directly run by Unit as an ASGI callable.

  4. Set installation path permissions to secure access, for example:

    # chown -R app_user:app_group /path/to/app/

    Update the placeholders above with actual values, noting them for later use in Unit configuration.

  5. Next, put together the Responder configuration for Unit:

        "listeners": {
            "*:80": {
                "pass": "applications/responder"
        "applications": {
            "responder": {
                "type": "python 3",
                "user": "app_user",
                "group": "app_group",
                "path": "/path/to/app/",
                "home": "/path/to/app/venv/",
                "working_directory": "/path/to/app/",
                "module": "asgi",
                "callable": "app"
  6. Upload the updated configuration. Assuming the JSON above was added to config.json:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config/


    The control socket path may vary; run unitd --help or see Startup for details.

  7. After a successful update, your app should be available on the listener’s IP address and port:

    $ curl http://localhost
          Hello, World!
    $ curl http://localhost/hello/JohnDoe
          Hello, JohnDoe!