Super car management api
- python3.10+
- Postman ( this document supposes you use Postman)
- install dependencies with
$ pipenv install
- or
$ pip install -r requirements.txt
if you want to stick with just pip - Optional: You may need the Postman Agent to overcome CORS restrictions
- Must be lauched before using Postman
The agent can be downloaded at https://www.postman.com/downloads/postman-agent/
-
as vanilla Flask :
python src/rentacar.py [--host/-H '127.0.0.1' --port/-P 8888 --debug/-D]
-
As WSGI prod server using Gunicorn :
gunicorn [--bind 127.0.0.1:8888] rentacar:app
see Gunicorn man page for more options
Before the dataabase purge, you may want to make a copy of it.
The library used to store data enforces the model after the first insertion.
In order to add a field , just edit the database file
{
"version": 2,
"keys": [
"brand",
"color",
"year",
"category" < # a new field can be added here
],
"data": {
"543984382318218286": {
"brand": "Lada",
"year": "1982",
"color": "Soviet blue",
"category": ""
},
"176342342618812623": {
"year": "1978",
"color": "Metal green",
"brand": "Moskvitch",
"category": "Public cars"
},
"224950951376616862": {
"year": "1975",
"brand": "ZIL-115",
"color": "Black",
"category": "Armored vehicle"
}
}
}
Once added , it can be used into the queries.
- The library does not allow the easy update all records at once.
- A simple migration mechanism to update the database with new fields.
- A configuration file.