This repository contains the backend code of www.name-to-ethnicity.com.
git clone git@github.com:name-ethnicity-classifier/backend.git
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
Copy the .example.env
to a .env
.
flask run
If you need to develop CRUD features, you'll need to run a Postgres database in parallel for testing and development. Make sure you have docker installed.
To start the database and Adminer UI run:
sh ./start-dev-infrastructure.sh
If you want to reinitialize the database and remove the current data, run:
sh ./start-dev-infrastructure.sh --init
This script will run the docker-compose file inside the ./dev-infrastructure
folder. If you encount any errors that point to missing Postgres environment variables, you might need to copy the .env
into the ./dev-infrastructure
folder.
For unit and integration tests make sure you have an instance of the development database running and run:
pytest
Optionally, for a nicer view use the --it
flag.