Python FastApi website monitor
- Prepare a virtual Python 3.6+ environment
- Install requirements
$ pip install -r requirements.txt
- Run command
$ python main.py dev
to start the development server
Testing for FastAPI is based on pytest
See ./test/client.py
for script example, which took reference from fastapi docs:
Run $ pytest ./test/client.py
to start a test
Run $ ./script/pack.sh
to pack the project into ./build/fast_api_monitor.tar.gz
Run $ docker build -t python-api-monitor -f Dockerfile .
to make an docker image
- config
- dev.cfg: app cfg of dev mode, using python-dotenv))
- prod.cfg: app cfg of production mode
- uvicorn: cfg for uvicorn
- logger.json: logging cfg for uvicorn
- dev.json: cfg for uvicorn launcher of dev mode
- prod.json: cfg for uvicorn of prod mode
- build: deployment files
- controller: controller modules with router callbacks
- middleware: web app middlewares
- model: internal data models
- script: user defined scripts
- pack.sh: pack the web-app project
- service: service libraries
- test: custom python scripts for testing modules
- utils: base apis for web app modules
- app.py: fastapi application entry
- main.py: uvicorn entry
- run server in dev mode
$ python main.py dev
- add controller routes in
config/router.py
and add corresponding callbacks in./controller
- add services in
./service
for controllers - add data models in
./model
for services and controllers - add middlewares if necessary
- websocket server monitor
- persistence data store into DB
- notification with email
- business account for teams