A friend of mine asked for a straightforward example about how to use a custom font in Django. Here it is ; )
In a Python 3 (virtual) environment:
$ pip install Django==2.2
Simply follow Django's default:
$ python manage.py runserver
This repo contains only 3 commits. Here is a summary of what they do.
This install Django and sets a home page at the root of the server that just renders core/templates/core/index.html
.
Runnning the server and opening the home page you should see a heading with your browser's custom font.
This makes the basic setup for Django to handle and serve static files. In order to test it to see if works, it applies a custom font on h1
HTML tags.
Runnning the server and opening the home page you should see the heading with a sans-serif
font.
This commit uses Django ITC Std's .otf
file to load a custom font and applies it to h1
HTML tags.
Runnning the server and opening the home page you should see the heading with this sample custom font.