Skip to main content

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

  1. Add “blog” to your INSTALLED_APPS setting like this

INSTALLED_APPS = [
...
'blog',
]
  1. (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',
]
  1. Include the polls URLconf in your project urls.py like this

path('blog_api/', include('blog.urls')),
  1. Setup a module named ‘backend’

  2. Using celery.py.sample as a guide, setup celery do that tasks will work

  3. Run python manage.py migrate to create the blog models.

  4. Start the development server and visit http://127.0.0.1:8000/admin/

    to create a poll (you’ll need the Admin app enabled).

  5. Visit http://127.0.0.1:8000/blog_api/ to see something.

Running tests locally

The repository includes a standalone pytest configuration.

  1. Install test dependencies:

pip install pytest pytest-django
  1. Run tests from the repository root:

pytest -q

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

django_tcb_blog-0.31.5.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

django_tcb_blog-0.31.5-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file django_tcb_blog-0.31.5.tar.gz.

File metadata

  • Download URL: django_tcb_blog-0.31.5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for django_tcb_blog-0.31.5.tar.gz
Algorithm Hash digest
SHA256 702efe1eec7692e55f6cd99db4c4ac9162d7cec07a900d7487292f7ef9e73d5f
MD5 d4f6125a84d7b76dbaa5d5b74fdee6a5
BLAKE2b-256 8bf0595a912bbaed3c7fc98c378287f9ecd62609fbbb69ccbcd6dbab6db7a1d0

See more details on using hashes here.

File details

Details for the file django_tcb_blog-0.31.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tcb_blog-0.31.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4b3f2c0bf25fb538af819e44653d29b4b71dc2723ee468fe4312b160a40e9fde
MD5 93dd3495080ea222e03bd5486c2f6ba7
BLAKE2b-256 ad0c125aa90273bd943e8c8696879418dd727d9abd4d14ad3df714578d618a37

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