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.6

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.6
File Size Uploaded
django_blog_core-0.1.6.tar.gz 31.0 kB Details

Built distribution (wheel)

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

Total release size: 63.7 kB

Release files / django_blog_core-0.1.6.tar.gz

Download URL django_blog_core-0.1.6.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
434c7f2c6de3c45974c02f338c770b4d57e5149e3469de06ace7315b331db3ea
BLAKE2b-256 checksum
How to use checksums
814c2a275aca6cd34c3ca8579bf4ce50a61e1edd978e3dcdd31297d1d5580da7
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.6-py3-none-any.whl

Download URL django_blog_core-0.1.6-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27231924a016f7ea95ddfc08b87e7f2f7c37efed4cb78d477a1420af9f16f6e0
BLAKE2b-256 checksum
How to use checksums
50966fd589784f588dd8e97468530d18a121cd625dfbb1de4f3afa5037428855
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

This release

0.1.6 This release

2 release files

0.1.5

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