A Django backend based on DRF for blogging from TheCodeBlogs
Project description
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
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 pytest pytest-django
Run tests from the repository root:
pytest -q
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_tcb_blog-0.31.7.tar.gz.
File metadata
- Download URL: django_tcb_blog-0.31.7.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d98074f6bf8f657be145dcda367b8c4e84c98717d6be078885cce5f6865d2e53
|
|
| MD5 |
38331e7a8f9c1eb9999aa55291ebce3d
|
|
| BLAKE2b-256 |
ef5fa478f865f1fd3004287bb2070824a8145f9c95bc188ad1ce8ebfc1750e86
|
File details
Details for the file django_tcb_blog-0.31.7-py3-none-any.whl.
File metadata
- Download URL: django_tcb_blog-0.31.7-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45cc724ca33f5d8701eb1f8ff539d6d277229c4450f2812979dd9641419eb8e8
|
|
| MD5 |
f88bf391096aa6df1a78beaa2586eca8
|
|
| BLAKE2b-256 |
1b6d3333ee5fba4dda62ad0860256d92201e6340a278e70cf9e73ed3d278239d
|