Skip to main content

AutoREST

TravisCI PyPI Coveralls Documentation Status Code Style

Documentation: https://django-autorest.readthedocs.io

Source: https://github.com/gregschmit/django-autorest

PyPI: https://pypi.org/project/django-autorest/

AutoREST is a reusable Django app for building REST APIs from model definitions and (optionally) admin.py definitions.

The Problem: Building APIs for models is boring.

The Solution: This app builds them for you, optionally using your AdminSite as a guide, and you can just focus on the custom stuff.

How to Use

$ pip install django-autorest

Include autorest in your INSTALLED_APPS.

Settings

  • AUTOREST_ADMIN_SITE (default 'django.contrib.admin.site'): This is an import string to the admin site where autorest can get hints on how the API should be configured (e.g., list display fields, edit fields, readonly fields, etc). To disable this feature entirely, just set this to False.

  • AUTOREST_DEFAULT_USE_ADMIN_SITE (default False): Whether the default model functionality should be to get config hints from admin.py.

  • AUTOREST_DEFAULT_ENABLE (default: True): Whether API ViewSets/URLs should be built for models which don’t have an explicit entry in the AUTOREST_CONFIG. If this option is False, then only models defined in the AUTOREST_CONFIG will have URLs generated for them.

  • AUTOREST_CONFIG default:

{
    'auth': {
        'User': {
            'viewset': 'autorest.sample_user_viewset.UserViewSet',
        },
    },
}

AUTOREST_CONFIG Options:

  • use_admin_site: Whether to use the admin site to build the API.

  • serializer: An import string to a serializer instance. (Note: if you would use multiple serializers for different actions like list/detail, then you can use drf-action-serializer) to configure a single serializer that supports per-action field configuration.)

  • viewset: An import string to a full viewset for this model.

Contributing

Submit a pull request if you would like to contribute. You must only contribute code that you have authored or otherwise hold the copyright to, and you must make any contributions to this project available under the MIT license.

Development

AutoREST comes with a settings.py file, allowing it to run as a standalone project.

$ git clone https://github.com/gregschmit/django-autorest

Then you can go into the django-autorest directory and do the initial migrations and run the server (you may need to type python3 rather than python):

$ cd django-autorest
$ python manage.py migrate
$ python manage.py createsuperuser
...
$ python manage.py runserver

Then you can see the api at http://127.0.0.1:8000/api/.

Release files for django-autorest 1.0.1

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-autorest 1.0.1
File Size Uploaded
django-autorest-1.0.1.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-autorest 1.0.1
File Interpreter ABI Platform
django_autorest-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size:23.3 kB

Release files / django-autorest-1.0.1.tar.gz

Download URL django-autorest-1.0.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a738e74f525811b0e5e7de45c30e8cc47b5cf76f511baca0260193a3446199b9
BLAKE2b-256 checksum
How to use checksums
bcceecb4259bcac1d67382307f0f80f93a10bdcc53254b33c7ae61926b34a779
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9

Release files / django_autorest-1.0.1-py3-none-any.whl

Download URL django_autorest-1.0.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
740bec22ba7262dda60d818a342b83fb0ea1ee64ab8f97d677119532546aa4a1
BLAKE2b-256 checksum
How to use checksums
3b0a066bbc23b39b24167444bd16a27f5254fdd1d8f58c4f144d60d56383807f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.7.1

2 release files

0.2.5

2 release files

0.2.1

2 release files

0.1.3

2 release files

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