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
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
incore/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 DB
and create the tables used byDRF
$ 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 - Update project routing
from django.contrib import admin
from django.urls import path, include # <-- NEW: 'include` directive added
urlpatterns = [
path("admin/", admin.site.urls),
path("api/" , include("api.urls")), # <-- NEW: API routing rules
]
Step #7 -
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-api-generator-0.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc0239fb731d8383e3b99365c0f0f1d67ced49d84709ff370fb617808752de11 |
|
MD5 | 8feaa8b807e6bb9d949b1ee5b9bac85e |
|
BLAKE2b-256 | ecbc81a6807acbaf8d41bc4fd7b181cb4b64de89eeeebd5f5148ae650fdf6f4c |