Datasette 插件,可在 /-/uptime 显示运行时长
请在与 Datasette 相同的环境中安装此插件。
datasette install datasette-uptime
在 /-/uptime
添加一个端点,返回如下所示的 JSON
{
"started": 355764.709263208,
"now": 355824.192608208,
"uptime_seconds": 59.483345208049286,
"uptime_hours": 0.0165231515625136
}
这显示了服务器已运行的时间长度。
要在本地设置此插件,首先检出代码。然后创建一个新的虚拟环境
cd datasette-uptime
python3 -m venv venv
source venv/bin/activate
现在安装依赖项和测试依赖项
pip install -e '.[test]'
运行测试
pytest