Skip to main content

Django API generator over DRF

Project description

Django API Generator

The tool is able to generate APIs using Django & DRF stack with a minimum effort.

Actively supported by AppSeed via Email and Discord.


How to use it


Step #1 - Install the package via PIP

$ pip install django-api-generator
// OR
$ pip install git+https://github.com/app-generator/django-api-generator.git

Step #2 Update Configuration, include the new APP

INSTALLED_APPS = [
    'django_api_gen',            # Django API GENERATOR  # <-- NEW
    'rest_framework',            # Include DRF           # <-- NEW 
    'rest_framework.authtoken',  # Include DRF Auth      # <-- NEW   
]

Step #3 - Register the model in core/settings.py (API_GENERATOR section)

API_GENERATOR = {
    # pattern: 
    # API_SLUG -> Import_PATH 
    'books'  : "app1.models.Book",
}

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.TokenAuthentication',
    ],
}

Step #4 - Migrate Database

$ python manage.py makemigrations
$ python manage.py migrate

Step #5 - Generate API

$ python manage.py generate-api

The code is generated under the api folder in the root of the project.


Step #6 - Use API

If the managed model is Books, the API interface is /api/books/ and all CRUD methods are available.



Django API Generator - Open-source library provided by AppSeed

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

django-api-generator-0.0.4.tar.gz (9.1 kB view hashes)

Uploaded Source

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