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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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