Deploy the API
Deploy
with docker
Then access api at http://localhost:5000
with docker-compose
version: "3.9"
services:
boaviztapi:
image: ghcr.io/boavizta/boaviztapi:latest
environment:
- SPECIAL_MESSAGE="<p>my welcome message in HTML format</p>"
ports:
- "5000:5000"
boaviztapi-doc:
image: ghcr.io/boavizta/boaviztapi-doc:latest
environment:
- API_URL=http://boaviztapi_url.com
ports:
- "8080:8080"
with pip
boaviztapi pip package : https://pypi.org/project/boaviztapi/
from source
Prerequisite
Python 3 mandatory, python >=3.9 recommended, poetry recommended
clone the repo
Setup poetry
Install poetry.
Install dependencies and create a python virtual environment.
Launch a development server
Once in the poetry environment
Development server uses uvicorn and fastapi, you can launch development server with the uvicorn
CLI.
You can run the tests with pytest
.
CORS
By default, all origin are allowed. If you need to limit them set env value ALLOWED_ORIGINS
with the following format : ALLOWED_ORIGINS = '["url1", "url2", ...]'
Example : ALLOWED_ORIGINS='["https://datavizta.boavizta.org","https://boavizta.org"]'
Special message
You can customize the home page with a special message by setting the env value `SPECIAL_MESSAGE
in HTML format.
Example : SPECIAL_MESSAGE="<p>my welcome message in HTML format</p>"
SDK
python-sdk : https://pypi.org/project/boaviztapi-sdk/