Django Cast¶
Just another blogging / podcasting package
Documentation¶
The full documentation is at https://django-cast.readthedocs.io.
Installation Screencast¶
Quickstart¶
Install Django Cast:
pip install django-cast
Add django-cast and some dependencies to your INSTALLED_APPS
:
INSTALLED_APPS = (
...
"django.contrib.sites",
"imagekit",
"ckeditor",
"ckeditor_uploader",
"crispy_forms",
"django_filters",
"rest_framework",
"rest_framework.authtoken",
"filepond.apps.FilepondConfig",
"cast.apps.CastConfig",
"watson",
"fluent_comments",
"threadedcomments",
"django_comments",
...
)
SITE_ID = 1
Add required settings:
# CKEditor
CKEDITOR_UPLOAD_PATH = "uploads/ckeditor/"
CKEDITOR_IMAGE_BACKEND = "pillow"
AWS_QUERYSTRING_AUTH = False
X_FRAME_OPTIONS = "SAMEORIGIN"
CKEDITOR_CONFIGS = {
"default": {
"removePlugins": "stylesheetparser",
"allowedContent": True,
"enterMode": 2,
},
}
# REST
REST_FRAMEWORK = {
# Use Django's standard django.contrib.auth permissions,
# or allow read-only access for unauthenticated users.
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.SessionAuthentication",
"rest_framework.authentication.TokenAuthentication",
)
}
# django imagekit
IMAGEKIT_DEFAULT_CACHEFILE_STRATEGY="imagekit.cachefiles.strategies.Optimistic"
# Comments
COMMENTS_APP = 'fluent_comments'
FLUENT_COMMENTS_EXCLUDE_FIELDS = ('email', 'url', "title")
CAST_COMMENTS_ENABLED = True
Add Django Cast’s URL patterns:
from django.urls import include, path, re_path
from rest_framework.documentation import include_docs_urls
from rest_framework.authtoken import views as authtokenviews
urlpatterns = [
...
# Cast urls
path("api/api-token-auth/", authtokenviews.obtain_auth_token),
path("docs/", include_docs_urls(title="API service")),
path("ckeditor/", include("ckeditor_uploader.urls")),
# Uploads
path("uploads/", include("filepond.urls", namespace="filepond")),
# Cast
path("cast/", include("cast.urls", namespace="cast")),
# Threadedcomments
re_path(r'^cast/comments/', include('fluent_comments.urls')),
...
]
The api token auth urls and the docs urls are both necessary to provide api endpoints with the right namespace. The django-filepond app is used to dispatch uploads to the right media models.
Features Overview¶
- Support for responsive images / video / audio media objects
- Use django template syntax for posts allowing you to use custom template tags for galleries etc. for example
- Good looking file uploads via filepond
- Chaptermarks for podcast Episodes
- Fulltext search via django-watson
- Faceted navigation via django-filter
- Comments for posts via django-contrib-comments, django-threadedcomments and django-fluent-comments
Running Tests¶
Install Dependencies¶
Non python packages that are required but need to be installed using your operating system package manager:
- ffmpeg
Install packages that are required to be able to run the tests via poetry:
$ poetry install
Credits¶
Tools used in rendering this package: