{"id":16174842,"url":"https://github.com/app-generator/django-api-generator","last_synced_at":"2025-04-09T13:09:59.994Z","repository":{"id":61767386,"uuid":"554859587","full_name":"app-generator/django-api-generator","owner":"app-generator","description":"API Generator for Django - Open-Source Library | AppSeed","archived":false,"fork":false,"pushed_at":"2024-10-17T05:04:20.000Z","size":61,"stargazers_count":38,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T12:05:23.873Z","etag":null,"topics":["developer-tools","django","dynamic-programming","open-source","pypi-package"],"latest_commit_sha":null,"homepage":"https://app-generator.dev/docs/developer-tools/api-generator.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/app-generator.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-20T14:18:24.000Z","updated_at":"2025-01-10T06:15:40.000Z","dependencies_parsed_at":"2024-10-19T05:19:08.578Z","dependency_job_id":null,"html_url":"https://github.com/app-generator/django-api-generator","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"9bc2066c40062766c08b4df6bf44527310751c2a"},"previous_names":[],"tags_count":24,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fdjango-api-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fdjango-api-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fdjango-api-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fdjango-api-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/app-generator","download_url":"https://codeload.github.com/app-generator/django-api-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045245,"owners_count":21038554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","django","dynamic-programming","open-source","pypi-package"],"created_at":"2024-10-10T04:43:31.424Z","updated_at":"2025-04-09T13:09:59.980Z","avatar_url":"https://github.com/app-generator.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Django API Generator](https://app-generator.dev/docs/developer-tools/api-generator.html)\n\nSimple tool that **Generates Secure APIs** on top of `DRF` with minimum effort - actively supported by **[App-Generator](https://app-generator.dev/)**.\n\n- [Django - Build Services without Coding](https://www.youtube.com/watch?v=EtMCK5AmdQI) - video presentation\n\n\u003cbr /\u003e\n\n---\n\n\u003e For a **complete set of features** and long-term support, check out **[Dynamic Django](https://app-generator.dev/docs/developer-tools/dynamic-django/index.html)**, a powerful starter that incorporates:\n\n- [Dynamic DataTables](https://app-generator.dev/docs/developer-tools/dynamic-django/datatables.html): using a single line of configuration, the data saved in any table is automatically managed\n- [Dynamic API](https://app-generator.dev/docs/developer-tools/dynamic-django/api.html): any model can become a secure API Endpoint using DRF\n- [Dynamic Charts](https://app-generator.dev/docs/developer-tools/dynamic-django/charts.html): extract relevant charts without coding all major types are supported\n- [CSV Loader](https://app-generator.dev/docs/developer-tools/dynamic-django/csv-loader.html): translate CSV files into Django Models and (optional) load the information\n- Powerful [CLI Tools](https://app-generator.dev/docs/developer-tools/dynamic-django/cli.html) for the GIT interface, configuration editing, updating the configuration and database (create models, migrate DB)\n\n\u003cbr /\u003e\n\n\u003e Features\n\n- `API engine` provided by `DRF`\n- Secured by `JWT Tokens` (mutating requests)\n- `Minimal Configuration` (single line in config for each model)\n- `Handles any model` defined across the project\n- `CRUD` access logic:\n  - `READ` is public (all items, get item by ID)\n  - `Mutating requests` are protected by `JWT Tokens`\n\n\u003cbr /\u003e\n\n![Django API Generator - DRF Interface (open-source tool).](https://user-images.githubusercontent.com/51070104/197181145-f7458df7-23c3-4c14-bcb1-8e168882a104.jpg)\n\n\u003cbr /\u003e\n\n## How to use it\n\n\u003cbr /\u003e\n\n\u003e **Step #1** - `Install the package` \n\n```bash\n$ pip install django-api-generator\n// OR\n$ pip install git+https://github.com/app-generator/django-api-generator.git\n```\n\n\u003cbr /\u003e\n\n\u003e **Step #2** - `Update Configuration`, include the new APPs\n\n```python\nINSTALLED_APPS = [\n    'django_api_gen',            # Django API GENERATOR  # \u003c-- NEW\n    'rest_framework',            # Include DRF           # \u003c-- NEW \n    'rest_framework.authtoken',  # Include DRF Auth      # \u003c-- NEW   \n]\n```\n\n\u003cbr /\u003e\n\n\u003e **Step #3** - `Register the model` in `core/settings.py` (API_GENERATOR section)\n\nThis sample code assumes that `app1` exists and model `Book` is defined and migrated.\n\n```python\nAPI_GENERATOR = {\n    # pattern: \n    # API_SLUG -\u003e Import_PATH \n    'books'  : \"app1.models.Book\",\n}\n\nREST_FRAMEWORK = {\n    'DEFAULT_AUTHENTICATION_CLASSES': [\n        'rest_framework.authentication.SessionAuthentication',\n        'rest_framework.authentication.TokenAuthentication',\n    ],\n}\n```\n\n\u003cbr /\u003e\n\n\u003e **Step #4** - `Migrate DB` and create the tables used by `DRF` \n\n```bash\n$ python manage.py makemigrations\n$ python manage.py migrate\n```\n\n\u003cbr /\u003e\n\n\u003e **Step #5** - `Generate API` \n\n```bash\n$ python manage.py generate-api\n// OR \n$ python manage.py generate-api -f # supress confirmation (forcing mode)\n```\n\nThe code is generated under the `api` folder in the ROOT of the project. At each iteration the **API code is overwritten**.\n\n\u003cbr /\u003e\n\n\u003e **Step #6** - `Update routing`, include APIs \n\n```python\nfrom django.contrib import admin\nfrom django.urls import path, include                        # \u003c-- UPD: 'include` directive\nfrom rest_framework.authtoken.views import obtain_auth_token # \u003c-- NEW\n\nurlpatterns = [\n    path(\"admin/\", admin.site.urls),\n    path(\"api/\",   include(\"api.urls\")),        # \u003c-- NEW\n    path('login/jwt/', view=obtain_auth_token), # \u003c-- NEW\n]    \n```    \n\n\u003cbr /\u003e\n\n\u003e **Step #7** - `Use API` \n\nIf the managed model is `Books`, the API interface is `/api/books/` and all CRUD methods are available. \n\n\u003e Note: for mutating requests, the `JWT Token` is provided by `http://localhost:8000/login/jwt/` route (the user should exist).\n\n\u003cbr /\u003e\n\n![Django API Generator - POSTMAN Interface (open-source tool).](https://user-images.githubusercontent.com/51070104/197181265-eb648e27-e5cf-4f3c-b330-d000aba53c6a.jpg)\n\n\u003cbr /\u003e\n\n### Links \u0026 resources \n\n- [DRF](https://www.django-rest-framework.org/) - HOMEpage\n- More [Developer Tools](https://appseed.us/developer-tools/) provided by `AppSeed`\n- Ask for [Support](https://appseed.us/support/) via `Email` \u0026 `Discord` \n\n\u003cbr /\u003e\n\n---\n[Django API Generator](https://app-generator.dev/docs/developer-tools/api-generator.html) - Open-source library provided by **[App-Generator](https://app-generator.dev/)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-generator%2Fdjango-api-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapp-generator%2Fdjango-api-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-generator%2Fdjango-api-generator/lists"}