API readme
This commit is contained in:
parent
289cc01544
commit
11522ac19b
2 changed files with 39 additions and 3 deletions
|
@ -2,8 +2,42 @@
|
|||
|
||||
This API enables the OVDashboard UI to run.
|
||||
|
||||
|
||||
## Quick Start
|
||||
|
||||
Preferably, use the `docker` image at `TODO` to run API and UI simultaneously. Refer to the [main config](TODO) for how to do that.
|
||||
Preferably, use the `docker` image at `TODO` to run this API and its UI simultaneously. Refer to the [main README](../README.md) for how to do that.
|
||||
|
||||
## Running the API
|
||||
|
||||
## Running the API without a container
|
||||
|
||||
Install the `ovdashboard_api` python package, you can:
|
||||
|
||||
- use `uvicorn` or another ASGI runner to start the app object `ovdashboard_api:app` <br />
|
||||
Example: `uvicorn 'ovdashboard_api:app'`
|
||||
- run the provided `ovdashboard-api` script – this is basically a shorthand for `uvicorn`
|
||||
- use `gunicorn` or another application server with ASGI workers (can be provided by `uvicorn`) <br />
|
||||
Example: `gunicorn 'ovdashboard_api:app' --worker-class uvicorn.workers.UvicornWorker`
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
The OVDashboard API is fully configured by environment variables or an `.env` file in the current working directory. Refer to the [main README](../README.md) for the list of variables.
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
Refer to your distribution's manual for how to install these dependencies.
|
||||
|
||||
- Python 3.9 with pip <br />
|
||||
If `python3 --version` shows "Python 3.9" or later, and `python3 -m pip` does execute, you're good to go
|
||||
- git (recommended)
|
||||
- libmagic
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
If `git` is installed, install `ovdashboard_api` directly using this command:
|
||||
|
||||
python3 -m pip install 'git+https://TODO#egg=ovdashboard_api&subdirectory=api'
|
||||
|
||||
If installing `git` is not an option, just [download and extract this repository's archive](TODO), then use the local path instead of the `git+https` URL for `pip install`.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
from uvicorn import run as uvicorn_run
|
||||
|
||||
from .settings import SETTINGS
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""
|
||||
|
@ -10,7 +12,7 @@ def main() -> None:
|
|||
app="ovdashboard_api:app",
|
||||
host="0.0.0.0",
|
||||
port=8000,
|
||||
reload=True,
|
||||
reload=not SETTINGS.production_mode,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue