基于django的github博客
github-blog的Python项目详细描述
安装
$ [sudo] pip install github-blog
功能
- github博客模型、视图、url模式、管理命令、脚本和模板
- 静态站点生成器
settings.py
INSTALLED_APPS=["django_summernote","github_blog","taggit"]+DJANGO_APPSTEMPLATES[0]['OPTIONS']['context_processors']+=["github_blog.context_processors.count","github_blog.context_processors.username"]GITHUB_TOKEN="<GITHUB_TOKEN>"GITHUB_USERNAME="<GITHUB_USERNAME>"# optional:GITHUB_BLOG_NEW_GIST_COUNT=5# 10 by defaultGITHUB_BLOG_NEW_POST_COUNT=5# 10 by defaultGITHUB_BLOG_NEW_REPO_COUNT=5# 10 by defaultGITHUB_BLOG_POST_PAGINATE_BY=5# 10 by default
型号
- github博客模型、视图、url模式、管理命令、脚本和模板
- 静态站点生成器
settings.py
INSTALLED_APPS=["django_summernote","github_blog","taggit"]+DJANGO_APPSTEMPLATES[0]['OPTIONS']['context_processors']+=["github_blog.context_processors.count","github_blog.context_processors.username"]GITHUB_TOKEN="<GITHUB_TOKEN>"GITHUB_USERNAME="<GITHUB_USERNAME>"# optional:GITHUB_BLOG_NEW_GIST_COUNT=5# 10 by defaultGITHUB_BLOG_NEW_POST_COUNT=5# 10 by defaultGITHUB_BLOG_NEW_REPO_COUNT=5# 10 by defaultGITHUB_BLOG_POST_PAGINATE_BY=5# 10 by default
型号
model | ^{ |
---|---|
^{ | StarredRepo(id, node_id, name, full_name, private, fork, description, homepage, language, forks_count, stargazers_count, watchers_count, open_issues_count, subscribers_count, network_count, size, has_issues, has_projects, has_wiki, has_pages, has_downloads, archived, disabled, pushed_at, created_at, updated_at, starred_at) |
^{ | Category(id, title, slug, parent, is_published) |
^{ | StarredRepoTopic(id, tag, content_object) |
^{ | PostTag(id, tag, content_object) |
^{ | RepoTopic(id, tag, content_object) |
^{ | Gist(id, node_id, public, created_at, updated_at, description, comments, description_noemoji) |
^{ | Post(id, title, slug, intro, body, category, is_published, created_by, created_at, updated_at) |
^{ | Repo(id, node_id, name, full_name, private, fork, description, homepage, language, forks_count, stargazers_count, watchers_count, open_issues_count, subscribers_count, network_count, size, has_issues, has_projects, has_wiki, has_pages, has_downloads, archived, disabled, pushed_at, created_at, updated_at) |
^{ | StarredGist(id, node_id, public, created_at, updated_at, description, comments, description_noemoji) |
命令
command | ^{ |
---|---|
^{ | collect github repos, gists, starred repos and starred gists |
^{ | collect github gists |
^{ | collect github repos |
^{ | collect github starred gists |
^{ | collect github starred repos |
^{ | static site generator |
脚本使用
command | ^{ |
---|---|
^{ | ^{ |
^{ | ^{ |
示例
urls.py
fromdjango.contribimportadminfromgithub_blog.urlsimportgithub_blog_urlsurlpatterns=[path('admin/',admin.site.urls),path('summernote/',include('django_summernote.urls')),]+github_blog_urls
$ python -u manage.py collect_github
静态站点生成器:
$ github-blog-clean path/to/<username>.github.com # remove .html files $ python -u manage.py staticgen <ip:port> path/to/<username>.github.com # generate .html files $ github-blog-push path/to/<username>.github.com # push to github