datasette-gunicorn


Namedatasette-gunicorn JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/simonw/datasette-gunicorn
SummaryRun a Datasette server using Gunicorn
upload_time2022-12-18 06:45:03
maintainer
docs_urlNone
authorSimon Willison
requires_python>=3.7
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datasette-gunicorn

[![PyPI](https://img.shields.io/pypi/v/datasette-gunicorn.svg)](https://pypi.org/project/datasette-gunicorn/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-gunicorn?include_prereleases&label=changelog)](https://github.com/simonw/datasette-gunicorn/releases)
[![Tests](https://github.com/simonw/datasette-gunicorn/workflows/Test/badge.svg)](https://github.com/simonw/datasette-gunicorn/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-gunicorn/blob/main/LICENSE)

Run a [Datasette](https://datasette.io/) server using [Gunicorn](https://gunicorn.org/)

## Installation

Install this plugin in the same environment as Datasette.

    datasette install datasette-gunicorn

## Usage

The plugin adds a new `datasette gunicorn` command. This takes most of the same options as `datasette serve`, plus one more option for setting the number of Gunicorn workers to start:

`-w/--workers X` - set the number of workers. Defaults to 1.

To start serving a database using 4 workers, run the following:

    datasette gunicorn fixtures.db -w 4

It is advisable to switch your datasette [into WAL mode](https://til.simonwillison.net/sqlite/enabling-wal-mode) to get the best performance out of this configuration:

    sqlite3 fixtures.db 'PRAGMA journal_mode=WAL;'

Run `datasette gunicorn --help` for a full list of options (which are the same as `datasette serve --help`, with the addition of the new `-w` option).

## datasette gunicorn --help

Not all of the options to `datasette serve` are supported. Here's the full list of available options:

<!-- [[[cog
import cog
from datasette import cli
from click.testing import CliRunner
runner = CliRunner()
result = runner.invoke(cli.cli, ["gunicorn", "--help"])
help = result.output.replace("Usage: cli", "Usage: datasette")
cog.out(
    "```\n{}\n```".format(help)
)
]]] -->
```
Usage: datasette gunicorn [OPTIONS] [FILES]...

  Start a Gunicorn server running to serve Datasette

Options:
  -i, --immutable PATH      Database files to open in immutable mode
  -h, --host TEXT           Host for server. Defaults to 127.0.0.1 which means
                            only connections from the local machine will be
                            allowed. Use 0.0.0.0 to listen to all IPs and allow
                            access from other machines.
  -p, --port INTEGER RANGE  Port for server, defaults to 8001. Use -p 0 to
                            automatically assign an available port.
                            [0<=x<=65535]
  --cors                    Enable CORS by serving Access-Control-Allow-Origin:
                            *
  --load-extension TEXT     Path to a SQLite extension to load
  --inspect-file TEXT       Path to JSON file created using "datasette inspect"
  -m, --metadata FILENAME   Path to JSON/YAML file containing license/source
                            metadata
  --template-dir DIRECTORY  Path to directory containing custom templates
  --plugins-dir DIRECTORY   Path to directory containing custom plugins
  --static MOUNT:DIRECTORY  Serve static files from this directory at /MOUNT/...
  --memory                  Make /_memory database available
  --config CONFIG           Deprecated: set config option using
                            configname:value. Use --setting instead.
  --setting SETTING...      Setting, see
                            docs.datasette.io/en/stable/settings.html
  --secret TEXT             Secret used for signing secure values, such as
                            signed cookies
  --version-note TEXT       Additional note to show on /-/versions
  --help-settings           Show available settings
  --create                  Create database files if they do not exist
  --crossdb                 Enable cross-database joins using the /_memory
                            database
  --nolock                  Ignore locking, open locked files in read-only mode
  -w, --workers INTEGER     Number of Gunicorn workers  [default: 1]
  --help                    Show this message and exit.

```
<!-- [[[end]]] -->

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

    cd datasette-gunicorn
    python3 -m venv venv
    source venv/bin/activate

Now install the dependencies and test dependencies:

    pip install -e '.[test]'

To run the tests:

    pytest

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/simonw/datasette-gunicorn",
    "name": "datasette-gunicorn",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f7/ea/a930415f1c3b4272a8ace361acabb467288d0207b42bd5caf6c5da2fa8d7/datasette-gunicorn-0.1.1.tar.gz",
    "platform": null,
    "description": "# datasette-gunicorn\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-gunicorn.svg)](https://pypi.org/project/datasette-gunicorn/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-gunicorn?include_prereleases&label=changelog)](https://github.com/simonw/datasette-gunicorn/releases)\n[![Tests](https://github.com/simonw/datasette-gunicorn/workflows/Test/badge.svg)](https://github.com/simonw/datasette-gunicorn/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-gunicorn/blob/main/LICENSE)\n\nRun a [Datasette](https://datasette.io/) server using [Gunicorn](https://gunicorn.org/)\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    datasette install datasette-gunicorn\n\n## Usage\n\nThe plugin adds a new `datasette gunicorn` command. This takes most of the same options as `datasette serve`, plus one more option for setting the number of Gunicorn workers to start:\n\n`-w/--workers X` - set the number of workers. Defaults to 1.\n\nTo start serving a database using 4 workers, run the following:\n\n    datasette gunicorn fixtures.db -w 4\n\nIt is advisable to switch your datasette [into WAL mode](https://til.simonwillison.net/sqlite/enabling-wal-mode) to get the best performance out of this configuration:\n\n    sqlite3 fixtures.db 'PRAGMA journal_mode=WAL;'\n\nRun `datasette gunicorn --help` for a full list of options (which are the same as `datasette serve --help`, with the addition of the new `-w` option).\n\n## datasette gunicorn --help\n\nNot all of the options to `datasette serve` are supported. Here's the full list of available options:\n\n<!-- [[[cog\nimport cog\nfrom datasette import cli\nfrom click.testing import CliRunner\nrunner = CliRunner()\nresult = runner.invoke(cli.cli, [\"gunicorn\", \"--help\"])\nhelp = result.output.replace(\"Usage: cli\", \"Usage: datasette\")\ncog.out(\n    \"```\\n{}\\n```\".format(help)\n)\n]]] -->\n```\nUsage: datasette gunicorn [OPTIONS] [FILES]...\n\n  Start a Gunicorn server running to serve Datasette\n\nOptions:\n  -i, --immutable PATH      Database files to open in immutable mode\n  -h, --host TEXT           Host for server. Defaults to 127.0.0.1 which means\n                            only connections from the local machine will be\n                            allowed. Use 0.0.0.0 to listen to all IPs and allow\n                            access from other machines.\n  -p, --port INTEGER RANGE  Port for server, defaults to 8001. Use -p 0 to\n                            automatically assign an available port.\n                            [0<=x<=65535]\n  --cors                    Enable CORS by serving Access-Control-Allow-Origin:\n                            *\n  --load-extension TEXT     Path to a SQLite extension to load\n  --inspect-file TEXT       Path to JSON file created using \"datasette inspect\"\n  -m, --metadata FILENAME   Path to JSON/YAML file containing license/source\n                            metadata\n  --template-dir DIRECTORY  Path to directory containing custom templates\n  --plugins-dir DIRECTORY   Path to directory containing custom plugins\n  --static MOUNT:DIRECTORY  Serve static files from this directory at /MOUNT/...\n  --memory                  Make /_memory database available\n  --config CONFIG           Deprecated: set config option using\n                            configname:value. Use --setting instead.\n  --setting SETTING...      Setting, see\n                            docs.datasette.io/en/stable/settings.html\n  --secret TEXT             Secret used for signing secure values, such as\n                            signed cookies\n  --version-note TEXT       Additional note to show on /-/versions\n  --help-settings           Show available settings\n  --create                  Create database files if they do not exist\n  --crossdb                 Enable cross-database joins using the /_memory\n                            database\n  --nolock                  Ignore locking, open locked files in read-only mode\n  -w, --workers INTEGER     Number of Gunicorn workers  [default: 1]\n  --help                    Show this message and exit.\n\n```\n<!-- [[[end]]] -->\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n    cd datasette-gunicorn\n    python3 -m venv venv\n    source venv/bin/activate\n\nNow install the dependencies and test dependencies:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Run a Datasette server using Gunicorn",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "51f9bbdcaad35acfa57f06e01e791ddb",
                "sha256": "54a66d345713345be3ed791280f104f31ea7e86f243962cfb76df8aa071ad8d9"
            },
            "downloads": -1,
            "filename": "datasette_gunicorn-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "51f9bbdcaad35acfa57f06e01e791ddb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8590,
            "upload_time": "2022-12-18T06:45:01",
            "upload_time_iso_8601": "2022-12-18T06:45:01.862868Z",
            "url": "https://files.pythonhosted.org/packages/f0/cc/a77137b30be3552b2ebfda711570c648ba6e7f842f1a202420b6747d21f9/datasette_gunicorn-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "3b0428114c4da70c1c56eea6b533041c",
                "sha256": "3dabced1e00ed60e0cb85133f04836a355e9ce0ced9fc174a229b5deb27de27e"
            },
            "downloads": -1,
            "filename": "datasette-gunicorn-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3b0428114c4da70c1c56eea6b533041c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8105,
            "upload_time": "2022-12-18T06:45:03",
            "upload_time_iso_8601": "2022-12-18T06:45:03.249512Z",
            "url": "https://files.pythonhosted.org/packages/f7/ea/a930415f1c3b4272a8ace361acabb467288d0207b42bd5caf6c5da2fa8d7/datasette-gunicorn-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-18 06:45:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "simonw",
    "github_project": "datasette-gunicorn",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datasette-gunicorn"
}
        
Elapsed time: 0.16534s