A helper for studying chinese
- This project developed on python
3.10.12
- Prepare python virtual environment:
python -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Run
deactivate
to deactivate the virtual env
- Run
- Install dependencies:
pip install -r requirements.txt
- Prepare your database
- Or if you have docker, run
docker compose up -d
(with .env setup below)
- Or if you have docker, run
- Create
.env
file at project root (change the values accordingly)DB_USER=postgres DB_PASSWORD=somepassword DB_HOST=localhost DB_PORT=5432 DB_NAME=hanzi_memo DB_DEBUG=false
- Create the tables:
python -m alfred migrate # to drop all tables python -m alfred migrate drop
- Parse and fill the database initial data, including dictionary, collections and sample text
# 120,000+ entry, might take a long time python -m alfred seed_dict cedict # 6000+ entry + checking duplicate, might take a long time # you can selectively pick which collection to seed python -m alfred seed_coll hsk1 hsk2 hsk3 hsk4 hsk5 hsk6 # load sample text python -m alfred seed_text demo
- To run the app
# development litestar run --reload # deploy litestar run --host 0.0.0.0
- Schema available at
GET /schema/