Skip to main content

django-blog-core

CI/CD PyPI License: MIT Docs codecov

Reusable multi-blog Django app: Blog, optional Section, and Article with draft / scheduled / published / archived workflow, RSS + Atom feeds, a Pinax-style hookset, secret preview URLs, and optional Markdown / HTML sanitize extras.

Status: 0.1.x on PyPI. Extras [search], [tags], [social], [images] are documented stubs; [events] ships a working, opt-in ArticleEvent timeline model.

Install

pip install django-blog-core
pip install "django-blog-core[markdown]"   # Markdown bodies
pip install "django-blog-core[sanitize]"   # bleach HTML policy
pip install "django-blog-core[all]"        # markdown + sanitize

Quickstart

# settings.py
INSTALLED_APPS = [
    # ...
    "blog_core",
]

BLOG_CORE = {
    "PAGINATE_BY": 12,
    "SANITIZE_HTML": True,
    # "HOOKSET": "myapp.hooks.BlogHookSet",
}
# Or: BLOG_CORE_HOOKSET = "myapp.hooks.BlogHookSet"
# urls.py
from django.urls import include, path

urlpatterns = [
    path("blog/", include("blog_core.urls")),
]
python manage.py migrate
python manage.py publish_scheduled_articles   # cron / host scheduler

Create a Blog and Article in admin. Public list/detail live at /blog/<blog-slug>/ and /blog/<blog-slug>/<article-slug>/. Feeds:

  • /blog/<blog-slug>/feed/rss/
  • /blog/<blog-slug>/feed/atom/

Preview drafts with the secret URL from the admin “Preview” column.

Public visibility

Article.objects.published() (alias public()) is the single source of truth:

state == "published" and publish_at <= now.

Hookset

Subclass blog_core.hookset.DefaultBlogHookSet to customize absolute URLs, who may view non-public articles, body rendering, and feed titles — without forking the package. Hooksets must not widen the public queryset.

HTML / Markdown safety

  • Markdown → HTML via the [markdown] extra.
  • HTML (and Markdown output) is sanitized with bleach when [sanitize] is installed and BLOG_CORE["SANITIZE_HTML"] is true (default).
  • Without bleach, HTML is escaped rather than passed through.
  • Set ALLOW_RAW_HTML = True only if you accept XSS risk. See docs/sanitize.md.

Extras

Extra Purpose
[markdown] Markdown body rendering
[sanitize] bleach allow-list
[search] stub — Haystack/published() index patterns
[tags] stub — tagging integration
[social] stub — share matrix
[images] stub — media attachments
[events] domain-neutral ArticleEvent timeline; opt in via INSTALLED_APPS — see docs/extras.md

Development

pip install -e ".[testing]"
pytest
# or: tox -e py313-django52

License

MIT — see LICENSE.

Metadata

Release files for django-blog-core 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-blog-core 0.1.5
File Size Uploaded
django_blog_core-0.1.5.tar.gz 30.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-blog-core 0.1.5
File Interpreter ABI Platform
django_blog_core-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 63.7 kB

Release files / django_blog_core-0.1.5.tar.gz

Download URL django_blog_core-0.1.5.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d2e4ae12397c1b90b3293e59184ef96133ca832d7137a411966549c9dd85c1eb
BLAKE2b-256 checksum
How to use checksums
a42fd92ce3af6e7c1d706f474f45fd12b21bd080caf89f113dac8087d2650d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / django_blog_core-0.1.5-py3-none-any.whl

Download URL django_blog_core-0.1.5-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d20fdb85efd32f63bd0ca73d19e62951e9ed0d799f1488af9fc7e18d708d9a2
BLAKE2b-256 checksum
How to use checksums
3cf9327e1f78fd629b0d0bf1ab1d453d816684580472d3a00b73d5d498bd0118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.1.6

2 release files

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page