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.

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

Development

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

License

MIT — see LICENSE.

Download files

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

Source Distribution

django_blog_core-0.1.2.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_blog_core-0.1.2-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file django_blog_core-0.1.2.tar.gz.

File metadata

  • Download URL: django_blog_core-0.1.2.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_blog_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a30a521b4c8621b78673ad2b4d60f9d5fd51b6963d2d31ac68f247701c07c5df
MD5 54ccbdd553938fb7ce1940ad04ff2a2f
BLAKE2b-256 a2d18e11b82645e945e29338dff4e1a5027bcb3168efebad96e12fe12a0ba916

See more details on using hashes here.

File details

Details for the file django_blog_core-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_blog_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce9b27d43314de40b63b4d8b6496ed6eef13c0f9f30688d49e030d2c73e812e1
MD5 15edf75ad8f3cc176f79b87014ed2e16
BLAKE2b-256 4963608fe4ad2f0498298f09be3ee4239d9d018b140fb4dbe71ac15c16ff89ae

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page