Skip to main content

Drop-in blog integration for Django & Flask — powered by EarlySEO. Articles are served from EarlySEO's CDN. Just add your site ID and go.

Project description

earlyseo-blog

Drop-in blog integration for Django and Flask — powered by EarlySEO. Articles are authored in the EarlySEO dashboard and served from a global CDN. This package fetches and renders them in your Python web app.

Quick start

pip install earlyseo-blog

Django

pip install "earlyseo-blog[django]"

settings.py

INSTALLED_APPS = [
    # …
    "earlyseo_blog.django",
]

EARLYSEO_SITE_ID = "your-site-id"   # from Dashboard → Integrations → SDK

urls.py

from django.urls import include, path

urlpatterns = [
    path("blog/", include("earlyseo_blog.django.urls")),
]

That's it — visit /blog to see your articles.

Template tags

Override the built-in fallback HTML by creating your own templates:

<!-- templates/earlyseo/blog_list.html -->
{% extends "base.html" %}
{% load earlyseo %}

{% block extra_head %}{% earlyseo_styles %}{% endblock %}

{% block content %}
  {% for article in articles %}
    <h2><a href="{% url 'earlyseo_blog:blog_detail' slug=article.slug %}">{{ article.title }}</a></h2>
    <p>{{ article.meta_description }}</p>
  {% endfor %}
{% endblock %}

Available template tags: {% earlyseo_styles %}, {% earlyseo_article_css %}, {% earlyseo_article article %}.


Flask

pip install "earlyseo-blog[flask]"

app.py

from flask import Flask
from earlyseo_blog.flask.views import create_blog_blueprint

app = Flask(__name__)
app.config["EARLYSEO_SITE_ID"] = "your-site-id"

app.register_blueprint(create_blog_blueprint(), url_prefix="/blog")

Override the built-in HTML by placing templates/earlyseo/blog_list.html and templates/earlyseo/blog_detail.html in your templates folder.


CLI scaffolding

The package includes a CLI to bootstrap templates and configuration:

earlyseo-blog

Run it from the root of your Django or Flask project. It will:

  1. Detect your framework
  2. Ask for your Site ID
  3. Generate starter templates and a .env file

Python client (standalone)

Use the client directly in any Python app:

from earlyseo_blog import EarlySeoClient

client = EarlySeoClient(site_id="your-site-id")

# List articles (page 1)
page = client.get_list_page(1)
for article in page.articles:
    print(article.title, article.slug)

# Get a single article
article = client.get_article("my-article-slug")
print(article.title)
print(article.content_html)

Async client

from earlyseo_blog import AsyncEarlySeoClient

async def main():
    async with AsyncEarlySeoClient(site_id="your-site-id") as client:
        page = await client.get_list_page(1)
        article = await client.get_article("my-article-slug")

Install the async extra for HTTP/2 support:

pip install "earlyseo-blog[async]"

Models

All responses are validated with Pydantic v2:

Model Description
Manifest Site manifest with total pages/articles
ArticleListItem Summary for list views
ArticleListPage Paginated list of ArticleListItem
Article Full article with content_html
from earlyseo_blog.models import Article, Manifest

CSS

Built-in styles for article content and blog layout:

from earlyseo_blog.css import ARTICLE_CSS, BLOG_CSS

Include them in your <style> tag or template to get default styling.


Configuration

Setting Description Default
site_id Your EarlySEO site ID (required)
cdn_base_url CDN base URL https://media.earlyseo.com

Django: Set EARLYSEO_SITE_ID and optionally EARLYSEO_CDN_BASE_URL in settings.py.

Flask: Set in app.config["EARLYSEO_SITE_ID"] and optionally app.config["EARLYSEO_CDN_BASE_URL"].


Requirements

  • Python ≥ 3.9
  • httpx ≥ 0.24
  • pydantic ≥ 2.0
  • Django ≥ 4.2 (for Django integration)
  • Flask ≥ 2.3 (for Flask integration)

License

MIT

Project details


Download files

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

Source Distribution

earlyseo_blog-1.0.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

earlyseo_blog-1.0.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file earlyseo_blog-1.0.0.tar.gz.

File metadata

  • Download URL: earlyseo_blog-1.0.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for earlyseo_blog-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bd8348be724a292ed9b7d39155a7d7085d92b49289b01f52b49345c6cb8a0cb8
MD5 d840b9d5fedd7230f8bc0b41b3b328d5
BLAKE2b-256 74a823ca522e946314d0842f431df38a1dfbb822dc56109c31a83ad77ecc9b6a

See more details on using hashes here.

File details

Details for the file earlyseo_blog-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: earlyseo_blog-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for earlyseo_blog-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0101ccc1f64c37f18a34eb5104583b1e4b089d89b2caa255a8eeb3b142cfe458
MD5 abb7135753d84e925d504abaa1aa046f
BLAKE2b-256 1cadaac13d4eb2468fdcc00d4937abbd871de6929a20596bf18d28136945be0c

See more details on using hashes here.

Supported by

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