Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

server-python-demo

Demo for hapiserver

To adapt to different data, modify the four files

  1. config.json or config-scripts.json
  2. catalog.py, which returns /catalog metadata
  3. info.py which returns /info metadata
  4. data.py which returns the /data response

Unit tests for the demo server in test/ can also be adapted.

Install

git clone https://github.com/hapi-server/server-python-demo
cd server-python-demo
python -m pip install -e .

Run standalone server

For a standalone server, start using

hapiserver --config hapiserver_demo/config.json --workers 2 --host 0.0.0.0 --port 8675
# or
# hapiserver --config hapiserver_demo/config-scripts.json --workers 2 --host 0.0.0.0 --port 8675

and see the comments in hapiserver_demo/*.py for adapting the demo to your data.

Alongside an existing ASGI or WSGI application

hapiserver uses the FastAPI framework to create an ASGI application.

To integrate the HAPI application (HAPI endpoints) into an existing ASGI application, see app.py.

To integrate HAPI endpoints into an existing WSGI application (built using frameworks such as Flask, Bottle, and Django), see server-general-psws, which adds HAPI endpoints to a Django application by converting the HAPI ASGI app to WSGI and combining it with the Django WSGI application.

Testing

conda create -n hapiserver-python-3.12-demo python=python3.12 pip
python -m pip install -e '.[test]'
python test/test_server.py

About

Demo template for hapiserver (server-python repository)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages