Skip to main content

Very simple app for REST API create via Django Framework

Build Status pypi python license Development status https://coveralls.io/repos/github/hulygun/django-api-toolkit/badge.svg?branch=master

Instalation

pip install django-api-toolkit

Get started

In the first you need initialize your project

project_init <path to project>

For existing projects you should to generate env file

env_generator <path to project>

This script generate base variables that needed to run project. You can also add youself variables in env file You should also change your manage.py. Add APIManager to your file. e.q.

#!/usr/bin/env python
import sys

from api_tools.utils import APIManager

if __name__ == "__main__":
    er = APIManager(__file__, 'cfg.settings')  # path to user project settings
    er.set_app_dir('apps')  # directory for user project applications
    er.apply()  # apply settings

    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

Usage

Structure

├── apps  # dir for your apps
├── cfg  # dir for diferent project configurations
│   ├── settings.py # user project settings
│   └── wsgi.py
└── manage.py

Settings

  • COMMON_APPS - django common applications

  • THIRD_PARTY_APPS - third party applications

  • EXTRA_APPS - applications should be insted before common apps

  • PROJECT_APPS - your project applications

You also can overwrite other standard django settings keys and add yourself variables

Models

All project models should be inherited of RestModel(this standart django abstract model and you can use all capabilities of this)

from api_tools.models import RestModel

class MyModel(RestModel):
    ...

Advanced

RestModel have subclass Rest. This subclass have properties for control your rest models. RestModel also have classmethods for these controls.

RestModel overwrites

RestModel.Rest

queryset:

defines queryset as lambda of model.objects

fields:

list of allowed fields of model

name:

name of viewset

route:

route of endpoint

RestModel._rest_serializer

Defines serializer for viewset of model

RestModel._rest_queryset

Defines queryset for viewset

RestModel._rest_endpoint

Set endpoint for your model

FEATURES

CHANGELOG

Metadata

Release files for django-api-toolkit 0.1.6

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-api-toolkit 0.1.6
File Size Uploaded Provenance Actions
django-api-toolkit-0.1.6.tar.gz 7.8 kB Without provenance Details for django-api-toolkit-0.1.6.tar.gz

Release files / django-api-toolkit-0.1.6.tar.gz

Download URL django-api-toolkit-0.1.6.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e62411f01578ad193838a2930bd5fa59a442355016c15e7da69eb68cf1d1248c
BLAKE2b-256 checksum
How to use checksums
3ae260bc0d1e304a4ab94748a8432e982291c29f29dfd1907fe64a211ec53624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-api-toolkit 0.1.6

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