Hanazono is a versatile tool designed to help you build a website for your personal notes while enhancing your learning through a spaced-repetition based daily quiz system using Leitner boxes.
It leverages MkDocs Material for writing notes, making it easy to create and manage your content.
You can check my hanazono azure or render (may be slow due to free hosting). Log in is required to have access to the Daily Quiz.
- write your notes as markdown
.md
file - define flashcards as a question admonition
or
??? question "<question>" <answer>
???+ question "<question>" <answer>
# Server port
SERVER_PORT = 8001
# Database creation (see [postgress](https://hub.docker.com/_/postgres))
POSTGRES_DB = "postgres"
POSTGRES_USER = "user"
POSTGRES_PASSWORD = "pwd"
# Database connection
POSTGRES_HOST = "db" # set it to "db" when using docker-compose (postgres service name)
POSTGRES_PORT = 5432
# Django admin
DJANGO_SUPERUSER_USERNAME=${POSTGRES_USER}
DJANGO_SUPERUSER_PASSWORD=${POSTGRES_PASSWORD}
DJANGO_SUPERUSER_EMAIL="[email protected]"
# Django settings
DJANGO_SETTINGS_MODULE="hanazono_conf.production"
SECRET_KEY = "y0urv3rys3cr3tk3y"
ALLOWED_HOSTS = "localhost"
STANDALONE = false
# Redis connection
REDIS_PORT = 6379
REDIS_HOST = "redis"
There are several ways to get your own Hanazono instance up and running. Choose the method that best suits your needs and technical expertise.
This is the easiest and most recommended approach if you're comfortable with Docker. It offers a streamlined setup with minimal configuration.
- setup your environment variables (automatic if you use pdm)
- write and put your notes as markdown files in the
docs
folder - start django server and postgres database services
docker-compose up
:- creates a postgres database
- extracts flashcards from your notes
- creates django admin user
- builds the site and run the django server on http://localhost:{SERVER_PORT}
As docs
folder is mounted in the server container: updates are directly available from the site. You just need to click on "Update site" from the admin panel.
Useful if you can't use docker-compose for instance free host provider such as render or azure.
Here, Hanazono operates within a single container and uses a local SQLite3 database instead of an external one.
- make sur to set:
DJANGO_SETTINGS_MODULE="hanazono_conf.production"
STANDALONE=true
to use a sqlite3 database
- use
Dockerfile.standalone
to build the imagedocker build -f Dockerfile.standalone -t hanazono-server:latest .
- push your image and upload it on your host
- run the server
docker run --env-file .env -p 8000:8000 hanazono-server:latest
- set
DJANGO_SETTINGS_MODULE="hanazono_conf.settings"
if in dev mode & make sure to have you database up and running - install dependencies
pdm install
- put environment variables in an
.env
file - start the postgres database
- initialize the server
pdm run init
(extracts flashcards and build the static files insite/
) - run the django server
pdm run manage runserver
Follow the same steps as above but without using PDM commands (refer to pyproject.toml
). Make sure to editably install the project.
To use the ai assistant package to help you generate notes or flashcards, change pdm install --without aiassistant
into pdm install
to install the aisan package. See example
- make a Notes django model
- provide tools to analyze flashcards/notes
- use ai assistant from the website directly
- re-write tests
- install without PDM
- start PostgreSQL database instructions
- add typing everywhere
-
add docstring (may not be necessary if typing & good naming) - add showcase video
- use a production server
- correctly package the project
- use a multi-stage build to install
aiasan
and only copy necessary files to lighten the image - deploy without docker-compose
- optional dependencies for ai assistant
- export & import database automatically on new deployement