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, X/Twitter, LinkedIn via django-environ), and Cloudinary / MediaAsset integration.

Current Version: 0.3.1

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=''),
        },
        '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=''),
        },
    }

Twitter / X (API v2) User Context Requirement
----------------------------------------------
Twitter's ``POST /2/tweets`` endpoint rejects OAuth 2.0 Application-Only Bearer Tokens with ``403 Forbidden``. To post tweets on behalf of an account, provide **OAuth 1.0a User Context** tokens in ``.env`` or via ``SocialPlatformConfig``:

- ``TWITTER_API_KEY`` (Consumer Key)
- ``TWITTER_API_SECRET`` (Consumer Secret)
- ``TWITTER_ACCESS_TOKEN`` (User Access Token)
- ``TWITTER_ACCESS_TOKEN_SECRET`` (User Access Token Secret)

**Critical Developer Portal Setting:**
In `Twitter Developer Portal <https://developer.x.com/>`_ under Project & App settings -> **User authentication settings**, set app permissions to **"Read and write"** *before* generating or regenerating the Access Token and Access Token Secret.

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.1

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.1
File Size Uploaded Provenance Actions
django_drf_blog_api-0.3.1.tar.gz 20.0 kB Without provenance Details for django_drf_blog_api-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 46.0 kB

Release files / django_drf_blog_api-0.3.1.tar.gz

Download URL django_drf_blog_api-0.3.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6c51eab6f6c29ad519590fa1d3bfe46fb348cf2bb1f3e7bff14c687311bdcba6
BLAKE2b-256 checksum
How to use checksums
4f7052fa4eec22db7e2c17461d01cb7af8ac114df32bd044e0b528812a68ccb5
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.1-py3-none-any.whl

Download URL django_drf_blog_api-0.3.1-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ef777a7d957b52af84dae14d363f754bb2fbe9fe4e5df907b49ab4fa5b8ff37
BLAKE2b-256 checksum
How to use checksums
8c7990663cd16403fbc629ae9ddfcc794a0261b996e825a44b7fcd11bbb4caee
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.1

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