Skip to main content

Django api manager and unifier

Project description

django-morest - make your api more rest

v0.0.1 - Basic functionality of api

Documentation

settings.py

INSTALLED_APPS = [
    ...
    "morest",
    ...
]

MIDDLEWARE = [
    "morest.middlewares.RequestIDMiddleware",
    "morest.middlewares.ExceptionMiddleware",
    ...
]

REST_FRAMEWORK = {
    'EXCEPTION_HANDLER': "morest.middlewares.DRFExceptionMiddleware",
}

usage

test view

from django.http import HttpRequest
from rest_framework.views import APIView
from morest.api import Response


class TestView(APIView):
    def get(self, request: HttpRequest):
        return Response({
            "key": "value"
        })

response

{
    "data": {
        "key": "value"
    },
    "status": "ok",
    "status_code": 200,
    "request_id": "4d06538d2d7b40db8e729757a363fe55",
    "message": "OK"
}

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_morest-0.0.4.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file django_morest-0.0.4.tar.gz.

File metadata

  • Download URL: django_morest-0.0.4.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for django_morest-0.0.4.tar.gz
Algorithm Hash digest
SHA256 65dbe754f8fd231db4a958f69b293ff0305b8f2c6e3de9bcb37a17ede374ade4
MD5 2025a1274786a860a8c4dde215b8d334
BLAKE2b-256 f4a3599115d194fba04709a41b04e7f36ff4ffb6859b98ee4982b8b7ba974220

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