- Python 100%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| dj_human_json | ||
| tests | ||
| .gitignore | ||
| .python-version | ||
| pyproject.toml | ||
| pytest.ini | ||
| README.md | ||
| uv.lock | ||
Django Human.json
This package implements the human.json protocol. The current supported protocol version is 0.1.1. Django admin is setup to create vouchers.
Setup
dj_human_json can be installed via PyPI or you can simply copy the dj_human_json directory in this repository into your Django project.
pip install django-human-json
Once you added dj_human_json to your INSTALLED_APPS, you need to add one new variable to your settings.py with the canonical URL you want to claim ownership for. Port, protocol and subdomain must be an exact match.
DJ_HUMAN_JSON_URL = "https://www.screamingatmyscreen.com" # replace with your own domain!
Include the dj_human_json view in your projects urls.py. The path does not matter.
from django.contrib import admin
from django.urls import path
from dj_human_json.views import human_json
urlpatterns = [
path("admin/", admin.site.urls),
path("human.json", human_json, name="human.json"),
]
Last step is advertising human.json via link in the head section of your HTML template.
<html lang="en">
<head>
<link rel="human-json" href="/human.json" />
</head>
You likely want to use the URL template tag and not be lazy as I am in this example.
Vouching for sites
Go to Djangos admin interface and create a new entry in the Vouch table or create vouches via shell.
Vouch.objects.create(url="https://www.screamingatmyscreen.com")
CI status
The public repository shows the CI as waiting which is a result of the repository being a push mirror and the actual CI running on our internal Forgejo instance. Releases are tested, pinky promise.