Skip to main content

=================== django-drf-blog-api

A reusable Django REST Framework blog and magazine API package with support for articles, magazine series editions, categories, tags, author profiles, backdated publications (pub_date), comments, likes, Social Media Auto-Posting (Facebook, Instagram, Threads, TikTok, X/Twitter, LinkedIn via django-environ), and Cloudinary / MediaAsset integration.

Current Version: 0.3.2

Quick Start

  1. Installation
.. code-block:: bash

    pip install django-drf-blog-api

2. Configure ``INSTALLED_APPS``

In your Django settings.py:

.. code-block:: python

INSTALLED_APPS = [
    ...,
    'rest_framework',
    'media_library',
    'django_drf_blog_api',
    'django_ckeditor_5',
]
  1. Configure Social Auto-Poster in settings.py
.. code-block:: python

    import environ
    import os

    env = environ.Env()
    environ.Env.read_env(os.path.join(BASE_DIR, '.env'))

    SOCIAL_AUTO_POST = {
        'FRONTEND_SITE_URL': env.str('FRONTEND_SITE_URL', default='https://yourdomain.com'),
        'FACEBOOK': {
            'ENABLED': env.bool('FACEBOOK_AUTO_POST_ENABLED', default=False),
            'PAGE_ID': env.str('FACEBOOK_PAGE_ID', default=''),
            'ACCESS_TOKEN': env.str('FACEBOOK_PAGE_ACCESS_TOKEN', default=''),
        },
        'INSTAGRAM': {
            'ENABLED': env.bool('INSTAGRAM_AUTO_POST_ENABLED', default=False),
            'ACCOUNT_ID': env.str('INSTAGRAM_ACCOUNT_ID', default=''),
            'ACCESS_TOKEN': env.str('INSTAGRAM_ACCESS_TOKEN', default=''),
        },
        'THREADS': {
            'ENABLED': env.bool('THREADS_AUTO_POST_ENABLED', default=False),
            'USER_ID': env.str('THREADS_USER_ID', default=''),
            'ACCESS_TOKEN': env.str('THREADS_ACCESS_TOKEN', default=''),
        },
        'TIKTOK': {
            'ENABLED': env.bool('TIKTOK_AUTO_POST_ENABLED', default=False),
            'ACCOUNT_ID': env.str('TIKTOK_ACCOUNT_ID', default=''),
            'ACCESS_TOKEN': env.str('TIKTOK_ACCESS_TOKEN', default=''),
        },
        'TWITTER': {
            'ENABLED': env.bool('TWITTER_AUTO_POST_ENABLED', default=False),
            'API_KEY': env.str('TWITTER_API_KEY', default=''),
            'API_SECRET': env.str('TWITTER_API_SECRET', default=''),
            'ACCESS_TOKEN': env.str('TWITTER_ACCESS_TOKEN', default=''),
            'ACCESS_TOKEN_SECRET': env.str('TWITTER_ACCESS_TOKEN_SECRET', default=''),
        },
        'LINKEDIN': {
            'ENABLED': env.bool('LINKEDIN_AUTO_POST_ENABLED', default=False),
            'ORGANIZATION_ID': env.str('LINKEDIN_ORGANIZATION_ID', default=''),
            'ACCESS_TOKEN': env.str('LINKEDIN_ACCESS_TOKEN', default=''),
        },
    }

Supported Social Media Platforms
--------------------------------
- **Facebook Pages**: Graph API v19.0 page feed sharing.
- **Instagram Business**: Two-step container creation & publishing (requires image).
- **Threads (Meta)**: Two-step media container & publish API.
- **TikTok**: Content Posting API direct post (requires image or video).
- **X / Twitter**: API v2 ``POST /2/tweets`` via OAuth 1.0a User Context.
- **LinkedIn**: UGC Post API v2.

4. Add URL Patterns
~~~~~~~~~~~~~~~~~~~
In your Django ``urls.py``:

.. code-block:: python

    from django.urls import path, include

    urlpatterns = [
        path('django_drf_blog_api/', include('django_drf_blog_api.urls')),
        path('media-library/', include('media_library.urls')),
    ]

5. Run Migrations
~~~~~~~~~~~~~~~~~
.. code-block:: bash

    python manage.py migrate

Key API Endpoints
-----------------

* **GET /django_drf_blog_api/post-list**: Public blog post list.
* **GET /django_drf_blog_api/post-list/<slug>**: Retrieve blog post by slug.
* **POST /django_drf_blog_api/post**: Create blog post (triggers social auto-posting).
* **GET /django_drf_blog_api/magazines**: List magazine series.
* **POST /django_drf_blog_api/magazines/**: Create magazine series edition.
* **GET /django_drf_blog_api/social-logs**: View social media auto-poster logs.

Metadata

Release files for django-drf-blog-api 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-drf-blog-api 0.3.2
File Size Uploaded Provenance Actions
django_drf_blog_api-0.3.2.tar.gz 21.3 kB Without provenance Details for django_drf_blog_api-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-drf-blog-api 0.3.2
File Interpreter ABI Platform Actions
django_drf_blog_api-0.3.2-py3-none-any.whl Python 3 none any Details for django_drf_blog_api-0.3.2-py3-none-any.whl

Total release size: 49.1 kB

Release files / django_drf_blog_api-0.3.2.tar.gz

Download URL django_drf_blog_api-0.3.2.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
97a990df71086d3b0e60c8d2ee8b7d020fd3b9c2f8224b585ad7d3f0fde5d63e
BLAKE2b-256 checksum
How to use checksums
c9c131f80b894bfc2913800b132a049a7c9e04daa423bbaa6afb20322db47b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / django_drf_blog_api-0.3.2-py3-none-any.whl

Download URL django_drf_blog_api-0.3.2-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2097d304bd67cfc46aa3fefabb330d2440611537969dcaa79aac8e68c684cfe4
BLAKE2b-256 checksum
How to use checksums
b93c865785e1265bd66a6280322e2532b8511937a1a200c3258eb574bb1a9acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for django-drf-blog-api 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page