Skip to main content

DRF Compose generates ready to use API using Django Rest Framework

Project description

https://img.shields.io/pypi/v/drf_compose.svg https://img.shields.io/travis/IamAbbey/drf_compose.svg Documentation Status Updates

DRF Compose is a Python package for defining and quick starting Django Rest Framework projects. With DRF Compose, you use a JSON or YAML file to configure your DRF application. Then, with a single command, you get to generate your DRF project code using all the specified configuration from your compose file. To learn more about all the features of DRF Compose, see the list of features below.

DRF Compose is aimed at making the process of starting a DRF project quick and fun - giving you a development head start experience - while also preventing any frustration caused by the inability to quick start an API.

Installing

Install and update using pip:

$ pip install -U drf_compose

Usage

Using DRF Compose is basically a two-step process:

  • Define your application in a drf-compose.json file.

  • Run drf-compose and the DRF compose command generates a ready to use DRF project code.

Command options overview and help

You can also see this information by running drf-compose –help from the command line.

Usage: drf-compose [OPTIONS]

  This script composes a DRF project.

Options:
  -s, --source FILE  Specify an alternate compose file as source  [default: drf-compose.json]
  --yaml             Indicates that the supplied source file is a YAML file
  --help             Show this message and exit.

Options

  1. name (required): specifies the project name.

  2. app_with_model (required): specifies details describing each apps in the DRF project.

    • app_name (required): specifies the app name

    • models: a list of models belonging to the app

      • name (required): specifies the model name

      • meta: specifies the different model meta options as in the Django model meta documentation

      • fields (required): a list of fields belonging to a model.

      • use_uuid_as_key (boolean): if True, a UUID is used as the model’s primary key.

      • str: specifies the field to be returned as representation of the model in __str__. Must be one of the specified field names

  3. auth_app: specifies details of the authentication application.

    • app_name (required): specifies the app name

    • model_name (required): specifies the model name for the custom user model

    • username_field: A string describing the name of the field on the user model that is used as the unique identifier Django USERNAME_FIELD documentation.

    • email_field: A string describing the name of the email field on the User model. Django’s EMAIL_FIELD documentation

    • required_fields: A list of the field names that will be prompted for when creating a user via the createsuperuser management command Django’s REQUIRED_FIELDS documentation

    • meta: specifies the different model meta options as in the Django model meta documentation

    • fields: a list of fields belonging to a model.

    • use_uuid_as_key (boolean): if True, a UUID is used as the model’s primary key.

    • str: specifies the field to be returned as representation of the model in __str__. Must be one of the specified field names

  4. include: specifies the addons to be included in the application.

    • simple_jwt (boolean): if True, includes Simple JWT JSON Web Token authentication plugin into the application.

      COMING SOON!

    • django_filter (boolean) if True, includes Django-filter, a reusable Django application allowing users to declaratively add dynamic QuerySet filtering from URL parameters.

    • docker (boolean): if True, includes docker setup option into the application.

    • dj-database-url (boolean): if True, includes DJ-Database-URL , a simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django application.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

drf_compose-0.1.1.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

drf_compose-0.1.1-py2.py3-none-any.whl (20.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file drf_compose-0.1.1.tar.gz.

File metadata

  • Download URL: drf_compose-0.1.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for drf_compose-0.1.1.tar.gz
Algorithm Hash digest
SHA256 37d940442468a0d43dd8c181d482b48688afa48997d5b53da208d3b9432a6132
MD5 90b93ff1dde1f03d678012881eaf27b9
BLAKE2b-256 f5ef2216d335dc0b98c86eb31cbe0a19bbb700020059f55a1bcc64ed905ff0bf

See more details on using hashes here.

File details

Details for the file drf_compose-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: drf_compose-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for drf_compose-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 90ccd55a23220f959165ccf7abdbf9598aa3d981d93b10136c1a772e730f2089
MD5 1a736ec1e188a5077add3d725c80f15f
BLAKE2b-256 e99a1f2d39143be4163c791309ae696f015d80cfb392aea8407776d64e5e559d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page