Skip to main content

spback (sun-praise backend) framework

PyPI Documentation Status Downloads

This project is built on django-ninja and django-ninja-extra.

Usage

Create your django project, start with the command: django-admin startproject conf ..

Update settings.py

If you need to use the feature of api, you need to install django-ninja-extra>=0.20.7, django-ninja-jwt>=5.3.1.

Add spback supported apps,

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # for example, "apis",
    ...
    "ninja_extra",  # for spback
]

API instance

create api instance.

from spback.urls import create_api

api = create_api()

JWT

If you want the JWT get authed, set the api with JWTAuth.

from ninja_extra.router import Router
from ninja_jwt.authentication import JWTAuth

router = Router()


@router.get("/", auth=JWTAuth())
def protected_endpoint(request):
    return {"message": "This is a protected endpoint."}

Error handler

register error handler

from spback.handler.errors import register_error_handler

api = register_error_handler(api)

Register to urls.py

With this code, the users could register django-ninja to urls.py

api = create_api()
api = register_routers(api)

urlpatterns = [
    path("", api.urls),
]

Register to conf/urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/", include("api.urls")),
]

For Developer

Use pdm run pip install -r requirements/dev.txt to install dev packages.

Metadata

Release files for spback 0.2.7

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

Source distribution (sdist)

Source distribution for spback 0.2.7
File Size Uploaded Provenance Actions
spback-0.2.7.tar.gz 153.4 kB Without provenance Details for spback-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spback 0.2.7
File Interpreter ABI Platform Actions
spback-0.2.7-py3-none-any.whl Python 3 none any Details for spback-0.2.7-py3-none-any.whl

Total release size: 317.6 kB

Release files / spback-0.2.7.tar.gz

Download URL spback-0.2.7.tar.gz
Size 153.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb6164478f77dbc9a3b4f261a0e2ebb78f88bb02984345db529f4f36e4a24979
BLAKE2b-256 checksum
How to use checksums
87000115f8b55eab7c839d97231f0a18824420c872d78fbb3000228fbe768ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / spback-0.2.7-py3-none-any.whl

Download URL spback-0.2.7-py3-none-any.whl
Size 164.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22eef9ddae774f138eb38216b427efb902fe2adea2409482c700b1c9f362f584
BLAKE2b-256 checksum
How to use checksums
3d62342422d4dca2441a5d3e9ccdd08937afc9d0d2227a51c8f56d6f39865fb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for spback 0.2.7

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