Skip to content

New name-to-ethnicity backend using Flask and SQLAlchemy in the making.

Notifications You must be signed in to change notification settings

name-ethnicity-classifier/backend

Repository files navigation

Test and Build

Name-to-ethnicity Backend

This repository contains the backend code of www.name-to-ethnicity.com.

🏃 Setup and run for development:

1. Clone repository:

git clone git@github.com:name-ethnicity-classifier/backend.git

2. Create and activate environment:

python3 -m venv .venv
source .venv/bin/activate

3. Install requirements:

pip3 install -r requirements.txt

4. Setup .env variables:

Copy the .example.env to a .env.

5. Start the server:

flask run

6. Start development database:

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.

🧪 Testing:

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.