TheCodeBlogs Blog Backend
Blogging made easy
Settings
These should go into your settings.py file.
TCB_BLOG_SETTINGS = {
'RSS_FEED_TITLE': 'Title of the blog',
'RSS_FEED_LINK': '/blog/',
'RSS_FEED_ITEM_DESC_TEMPLATE': 'feed/entries.html',
'API_CONTRACT_VERSION': '1.0.0',
'SUPPORTED_FRONTEND_VERSIONS': '>=0.31.0 <0.32.0'
}
If you enable django-upload, you can enforce backend upload policy in settings.py:
UPLOAD_ALLOWED_MIME_TYPES = [
# Images
'image/jpeg', 'image/png', 'image/gif',
# Video
'video/mp4', 'video/webm', 'video/ogg', 'video/quicktime',
'video/x-msvideo', 'video/x-ms-wmv', 'video/mpeg',
'video/3gpp', 'video/3gpp2', 'video/x-matroska', 'video/mp2t',
# Audio
'audio/mpeg', 'audio/mp4', 'audio/x-m4a', 'audio/aac',
'audio/ogg', 'audio/wav', 'audio/x-wav', 'audio/webm',
'audio/flac', 'audio/x-flac', 'audio/3gpp', 'audio/3gpp2',
'audio/aiff', 'audio/x-aiff',
]
UPLOAD_ALLOWED_EXTENSIONS = [
'jpg', 'jpeg', 'png', 'gif',
'mp4', 'webm', 'ogv', 'mov', 'avi', 'wmv', 'mpeg', 'mpg', 'mkv', 'ts',
'mp3', 'm4a', 'aac', 'ogg', 'wav', 'flac', 'aif', 'aiff',
]
# Default visibility when clients do not send the public flag
UPLOAD_DEFAULT_PUBLIC = True
Syncing entries to TheCodeBlogs
When an author’s profile has a token and url set (via Django Admin), published blog entries are automatically pushed to the destination site (e.g. https://www.thecodeblogs.com) via a Celery task.
Enabling sync:
Set the author’s token (a DRF token for the destination) and url (on the destination site) in the Django Admin under the author’s Profile record.
How it works:
On publish, the entry is POSTed to {url}/api/admin/entries/ with Authorization: Token <token> and an Idempotency-Key header ({entry_id}:{version}).
If the destination returns 5xx or a connection error, the task retries up to 5 times with exponential backoff (starting at 60s, capped at 30min). 4xx errors are permanent failures — no retry.
Each attempt is recorded in the EntrySync model, visible as a read-only inline on the entry in the admin. The admin also shows a color coded “Sync status” column and a “Mark as not synced (re-sync)” action.
Destination requirements:
The destination must run the same blog app with token authentication enabled, and the blog app mounted at /api/.
Quick start
Add “blog” to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
...
'blog',
]
(Optional) Install django-upload from git and add “upload” to INSTALLED_APPS to enable media uploads
pip install "django-upload @ git+https://git.jamesonnetworks.com/JamesonNetworks/django-upload.git@main"
INSTALLED_APPS = [
...
'blog',
'upload',
]
Include the polls URLconf in your project urls.py like this
path('blog_api/', include('blog.urls')),
Setup a module named ‘backend’
Using celery.py.sample as a guide, setup celery do that tasks will work
Run python manage.py migrate to create the blog models.
- Start the development server and visit http://127.0.0.1:8000/admin/
to create a poll (you’ll need the Admin app enabled).
Visit http://127.0.0.1:8000/blog_api/ to see something.
Running tests locally
The repository includes a standalone pytest configuration.
Install test dependencies:
pip install -r requirements-dev.txt
Run tests from the repository root:
pytest -q
Metadata
Release files for django-tcb-blog 0.33.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_tcb_blog-0.33.2.tar.gz | 40.0 kB | Without provenance | Details for django_tcb_blog-0.33.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_tcb_blog-0.33.2-py3-none-any.whl | Python 3 | none | any | Details for django_tcb_blog-0.33.2-py3-none-any.whl |
Total release size: 99.0 kB
Release files / django_tcb_blog-0.33.2.tar.gz
| Download URL | django_tcb_blog-0.33.2.tar.gz |
|---|---|
| Size | 40.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0addd57f439e388f72f075a1ea8782553390b0f1f6414f6ce96842f3f49da709
|
|
BLAKE2b-256 checksum How to use checksums |
dbd5fcf5fb3817b07ca1f85f971456ab8017e62cf48d05a5b12df48196123ea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / django_tcb_blog-0.33.2-py3-none-any.whl
| Download URL | django_tcb_blog-0.33.2-py3-none-any.whl |
|---|---|
| Size | 59.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcfa4b98f49a525bf3363ce2d2a1d18637841786b242fbceb0931d57abaf10b5
|
|
BLAKE2b-256 checksum How to use checksums |
38a26519dcd6094cf7cf0278f541a950280a98f7918f5116d9073f1b061cb53b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for django-tcb-blog 0.33.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.