Skip to main content

django models and management commands for generating github pages

Project description

Installation

$ [sudo] pip install django-github-pages

settings.py

INSTALLED_APPS = [
    "django_github_repo",
]

Config

$ export GITHUB_TOKEN="<xxx>"

Models

model __doc__
django_github_pages.models.Topic Topic model. fields: name. attr: repos. properties: count
django_github_pages.models.Repo Repo model. fields: owner, name, private, fork, description, homepage, language, topics

Commands

command help
python manage.py get sync github repos

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/

django-readme-generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-github-pages-2019.4.13.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page