Sweetblog is a Django application that simplifies blog creation and maintenance. It provides a clean, easy-to-use platform for running your own personal blog with minimal setup.
- Markdown Support: Write posts in Markdown with live preview in the admin interface
- Collections: Organize articles into collections (categories)
- Tags: Tag articles for better organization and discoverability
- Comments System: Built-in nested commenting system with reply functionality
- Engagement: Like/dislike system for articles
- View Tracking: Track article views and calculate reading time
- Multiple Themes: Support for Pico.css and Sakura.css frameworks
- Add Sweetblog to your Django project:
# Using pip
pip install sweetblog
# Using uv
uv add sweetblog- Configure Django settings:
Add to INSTALLED_APPS:
INSTALLED_APPS = [
'dal',
'dal_select2',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Sweetblog
'sweetblog',
'meta',
'treenode',
'magic_notifier',
]- Add Sweetblog settings:
# CSS Framework choice
CSS_FRAMEWORK = 'pico' # Options: 'pico', 'sakura'
# Media files
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Static files
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'- Include URLs:
In your main urls.py:
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('sweetblog.urls')),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)- Run migrations:
python manage.py makemigrations
python manage.py migrate- Create superuser:
python manage.py createsuperuser- Collect static files:
python manage.py collectstatic- Run server:
python manage.py runserver-
Login to Django Admin at
/admin/ -
Create a Collection (optional):
- Go to Collections -> Add Collection
- Enter name and description
-
Create an Article:
- Go to Articles -> Add Article
- Write content in Markdown
- Add tags and select collection
- Upload thumbnail image
- Save
Sweetblog supports standard Markdown syntax:
# Heading 1
## Heading 2
**Bold** and *italic*
- Bullet lists
1. Numbered lists
[Links](https://example.com)

`inline code`- HomeView: Lists recent articles with pagination
- CollectionDetailView: Shows articles in a specific collection
- ArticleDetailView: Displays single article with comments
- TagDetailView: Lists articles with a specific tag
sweetblog/
├── src/
│ └── sweetblog/
│ ├── models.py
│ ├── views.py
│ ├── urls.py
│ ├── admin.py
│ ├── serializers.py
│ ├── templates/
│ │ └── sweetblog/
│ │ ├── base_pico.html
│ │ ├── base_sakura.html
│ │ ├── home.html
│ │ └── article_detail.html
│ └── static/
│ └── sweetblog/
│ ├── css/
│ └── js/
│ └── article.js
└── tests/
└── testsweetblog/
└── settings.py
# Django settings
SECRET_KEY = 'your-secret-key'
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Sweetblog theme
CSS_FRAMEWORK = 'pico' # or 'sakura'python manage.py test sweetblog# Clone repository
git clone <repository-url>
cd sweetblog
# Install with uv
uv pip install -e .
# Run development server
python manage.py runserver- Django >= 4.0
- mistune (Markdown parser)
- Pillow (Image processing)
- Category: Article categories
- Collection: Groups of related articles
- Article: Base article model
- MarkdownArticle: Article with Markdown content
- Device: User device tracking
- Comment: Article comments
- Live Markdown preview widget
- Automatic HTML generation from Markdown
- Support for multiple Markdown fields on same page
See LICENSE file for details.