Skip to main content

Minimalistic CMS in Python with Markdown content

Features

  • No storages, simple file structure

  • Markdown content with images

  • Static auto-collection

  • Simple pagination

Requirements

  • Python 3.12

  • FastAPI 0.111.0

  • Jinja2 3.1.4

  • Markdown 3.6

  • PyYAML 6.0.1

  • python-slugify 8.0.4

  • pydantic 2.8.2

Install

python3.12 -m venv venv
source venv/bin/activate
pip install lazycms

Usage

Example project structure:

  • project/
    • static/
      • content/ - empty directory, static content will be collected here

      • theme/ - your theme css/js

    • storage/ - your file storage directory
      • article-1/ - entity (article) directory
        • content.md - your article

        • meta.yml - entity metadata

        • picture.jpeg - picture for your article

        • preview.md - entity article miniature for index page

      • article-2/
        • content.md

        • meta.yml

        • picture.jpeg

        • preview.md

    • templates/ - Jinja2 templates directory
      • index.html - entity index template with entity and paginator context objects

      • entity.html - entity template with entity context object

    • app.py - CMS code

    • app.yml - CMS config

project/storage/article-1/content.md:

# Article 1

![Article 1]({{slug_url}}/picture.jpeg "Article 1")

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

project/storage/article-1/preview.md:

![Article 1]({{slug_url}}/picture.jpeg "Article 1")

# Article 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam...

project/storage/article-1/meta.yml:

timestamp: !!timestamp 2024-01-01T17:00:00Z
title: Article 1
content: content.md
preview: preview.md
images:
    - picture.jpeg
tags:
    - article
    - test

project/templates/index.html:

{% for entity in entities %}
    <article>
        {{ entity.preview|safe }}
    </article>
{% endfor %}

{% if paginator.page > 1 %}
    <a href="/?page={{ paginator.page - 1 }}">Prev</a>
{% else %}
    Prev
{% endif %}
{% if paginator.page < paginator.page_count %}
    <a href="/?page={{ paginator.page + 1 }}">Next</a>
{% else %}
    Next
{% endif %}

project/templates/entity.html:

<article>
    {{ entity.content|safe }}
</article>

project/app.yml:

# Storage config
storage_type: FILE
storage_path: ./storage
storage_meta: meta.yml
# Static config
static_path: ./static
static_url: /static
# Static collected content config
collect_path: ./static/content
collect_url: /static/content
# Templates
templates_path: ./templates
# Pagination
paginate: 10

project/app.py:

from lazycms import LazyCMS


cms = LazyCMS(config_path='app.yml')

Run:

uvicorn app:cms.app --reload

http://localhost:8000 - index page

http://localhost:8000/2024-01-01-article-1 - Article 1 page

http://localhost:8000/2024-01-02-article-2 - Article 2 page

Tests

TBD

Metadata

Release files for lazycms 0.1.0

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

Source distribution (sdist)

Source distribution for lazycms 0.1.0
File Size Uploaded
lazycms-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lazycms 0.1.0
File Interpreter ABI Platform
lazycms-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / lazycms-0.1.0.tar.gz

Download URL lazycms-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
788d88a209957e42d131e206c022cdd89f0518e4c95e2439c2bd642ed11d0e6c
BLAKE2b-256 checksum
How to use checksums
31c634d63c4044674d561907e72b86c84f139c05d0e2cde76c9fa2fb604117da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release files / lazycms-0.1.0-py3-none-any.whl

Download URL lazycms-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
083947b2d50dbda7296bc445ada8fe2060113313fe7ce4db4cbc3c92fcf44e2e
BLAKE2b-256 checksum
How to use checksums
b8ad17f05010aaafb1e006cc85109c4df22b7c25c59d1af80d796505d6a10825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

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