使用Gunicorn运行Datasette服务器
项目描述
datasette-gunicorn
安装
在Datasette相同的环境中安装此插件。
datasette install datasette-gunicorn
用法
此插件添加了一个新的datasette gunicorn
命令。它接受与datasette serve
大多数相同的选项,还有一个用于设置要启动的Gunicorn工作进程数的选项。
-w/--workers X
- 设置工作进程数。默认为1。
要使用4个工作进程开始提供数据库服务,请运行以下命令
datasette gunicorn fixtures.db -w 4
建议将您的datasette切换到WAL模式,以从此配置中获得最佳性能
sqlite3 fixtures.db 'PRAGMA journal_mode=WAL;'
运行datasette gunicorn --help
以获取选项的完整列表(与datasette serve --help
相同,新增了-w
选项)。
datasette gunicorn --help
并非所有datasette serve
的选项都受支持。以下是完整选项列表
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.
开发
要本地设置此插件,首先检出代码。然后创建一个新的虚拟环境
cd datasette-gunicorn
python3 -m venv venv
source venv/bin/activate
现在安装依赖项和测试依赖项
pip install -e '.[test]'
要运行测试
pytest
项目详情
关闭
datasette-gunicorn-0.1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3dabced1e00ed60e0cb85133f04836a355e9ce0ced9fc174a229b5deb27de27e |
|
MD5 | 3b0428114c4da70c1c56eea6b533041c |
|
BLAKE2b-256 | f7eaa930415f1c3b4272a8ace361acabb467288d0207b42bd5caf6c5da2fa8d7 |
关闭
datasette_gunicorn-0.1.1-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 54a66d345713345be3ed791280f104f31ea7e86f243962cfb76df8aa071ad8d9 |
|
MD5 | 51f9bbdcaad35acfa57f06e01e791ddb |
|
BLAKE2b-256 | f0cca77137b30be3552b2ebfda711570c648ba6e7f842f1a202420b6747d21f9 |