This demo back-end application consists of two services, data processing service and API service.
- (Optional) Set up virtual environment
- Create a virtual environment,
python -m venv ign- Note: the virtual environment will be installed in current folder.
- Activate virtual environment for Linux,
source ign/bin/activate- For other OS, check out link
- Deactivate virtual environment,
deactivate - Delete the virtual environment,
rm -rf ign
- Create a virtual environment,
- Install dependencies, run
pip install -r requirements.txt- Note: you can verify this step by running
pytest
- Note: you can verify this step by running
- (Optional) Modify development environment variables in
.env.dev - Create and populate database, run
make populate_new_db - Start API server, run
make run_server
- Tests for this application are located in
tests/folder - (Optional) Modify variables are defined in
.env.test - Run all tests, run
pytest - Run a specific test, run
pytest tests/folder/filename.py::testname- For example,
pytest tests/simple_db/test_crud.py::test_review_get_by_id
- For example,
- change synchronous database operation to asynchronous.
- add proper cache mechanism. Current cache mechanism caches returned response as a whole, which could be a list, therefore, not very efficient. What's more, current design assumes no update on database.
- more comprehensive error handling on query.
- add logger.
- add functionality to update/insert new record to database, and dynamically reflect the new updates on the cache (or just mark the old data in cache as dirty and out-of-date).
- add more test cases.