Installation
$ [sudo] pip install django-github-pages
settings.py
INSTALLED_APPS = [
"django_github_pages",
]
Config
$ export GITHUB_TOKEN="<xxx>"
Classes
class | __doc__ |
---|---|
django_github_pages.models.Repo |
Repo model. fields: owner , name , private , fork , description , homepage , language , topics
|
django_github_pages.models.Topic |
Topic model. fields: name . attr: repos . properties: count
|
Examples
app/views.py
from django_github_pages.models import Repo, Topic
templates/topic_detail.html
{% for topic in topics %}
<a class="topic-tag topic-tag-link" href="{{ topic.get_absolute_url }}">{{ topic.name }} ({{ topic.count }})</a>
{% endfor %}
templates/repo_detail.html
{% load topics %}
<h3><a href="{{ repo.url }}">{{ repo.name }} </a></h3>
<div class="text-gray description">{{ repo.description }}</div>
{% for topic in repo.name|topics %}
<a class="topic-tag topic-tag-link f6" href="{{ topic.get_absolute_url }}">{{ topic.name }}</a>
{% endfor %}
manage.py
commands:
$ python manage.py get --progress # get Repo and Topics data (GITHUB_TOKEN required)
$ python manage.py clean # remove .html files (except templates/*.html) and empty folders
$ python manage.py open # open https://<username>.github.io/