Quick REST API creation
Project description
Django Start-API
Quick REST API creation.
Quick ready to use REST API based on Django and DRF, create your config file, launch 'startapi' and you will get:
- Standard Django project created
- All app created
For each app:
- Models already created and migrated
- For each model:
- full working api (GET, POST, PUT PATCH, DELETE) (refer to: https://www.django-rest-framework.org/api-guide/routers/#simplerouter)
- ModelViewSet already created
- ModelSerializer already created
- Registered urls with DefaultRouter
- Registered model in admin
Installation
pip install django_startapi
Quickstart
- Create your config.yaml
- Run 'startapi'
Usage
This software is intented to be used to create an initial full working REST API, based on Django and Django Rest Framework. Design apps with models inside a config file and run django_startapi.
- Create a config file named 'config.yaml'
- run startapi
- optional: python manage.py createsuperuser
- python manage.py runserver and go to http://127.0.0.1:8000/api/
Config file
- Add a project name used as for django-admin stratproject
- Define your apps with models, models fields are Django fields
Note: Write related model name as string or put related models before relation to avoid "NameError: name 'YourModel' is not defined"
Config file structure:
project: <your_project_name>
apps:
<app_name>:
<ModelName>:
field: SomeDjangoField()
field: SomeDjangoField()
...
<ModelName>:
field: SomeDjangoField()
field: SomeDjangoField()
...
<app_name>:
<ModelName>:
field: SomeDjangoField()
field: SomeDjangoField()
...
<ModelName>:
field: SomeDjangoField()
field: SomeDjangoField()
...
...
Example of config file
project: audiolibrary
apps:
band:
Musician:
name: CharField(max_length=40)
surname: CharField(max_length=40)
born_date: DateField(null=True)
Band:
name: CharField(max_length=100)
author: ManyToManyField('Musician')
album:
Genre:
name: CharField(max_length=100)
Label:
name: CharField(max_length=100)
Album:
name: CharField(max_length=120)
band: ForeignKey('band.Band', on_delete=models.DO_NOTHING)
label: ForeignKey('Label', on_delete=models.DO_NOTHING)
date: DateField(null=True)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-startapi-0.0.2.dev2.tar.gz.
File metadata
- Download URL: django-startapi-0.0.2.dev2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1252e15e0a3eaa19541809be44f8d87c896433ee3f95ada2ebfcb95bb1da1a6
|
|
| MD5 |
710cca4d09116bd97ff6ffe7ffd92fc7
|
|
| BLAKE2b-256 |
6e483f2537b541927a8224bf817a6b5c52026f480545632fcd9a08f6ad1a9fe1
|
File details
Details for the file django_startapi-0.0.2.dev2-py3-none-any.whl.
File metadata
- Download URL: django_startapi-0.0.2.dev2-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a741cc4537f371867e77569c732fe2621718f2858f503bfe96c38e74dd472b22
|
|
| MD5 |
b389d86199709db176e7fcdb5f97c6ec
|
|
| BLAKE2b-256 |
3e2812872381dc1471ae6f8eeed1d2eacebffe672b7b2ca57b6b30a448e4068a
|