Language: English | Chinese
Django Simple API
A non-intrusive component that can help you quickly create APIs.
Quick Start
Install
Download and install from github:
pip install django-simple-api
Configure
Add django-simple-api to your INSTALLED_APPS in settings:
INSTALLED_APPS = [
...,
"django_simple_api",
]
Register the middleware to your MIDDLEWARE in settings:
MIDDLEWARE = [
...,
"django_simple_api.middleware.SimpleApiMiddleware",
]
Add the url of django-simple-api to your urls.py:
# urls.py
from django.urls import include, path
from django.conf import settings
# Your urls
urlpatterns = [
...
]
# Simple API urls, should only run in a test environment.
if settings.DEBUG:
urlpatterns += [
# generate documentation
path("docs/", include("django_simple_api.urls"))
]
Complete the first example
Define your url:
# your urls.py
from django.urls import path
from yourviews import JustTest
urlpatterns = [
...,
path("/path/<int:id>/", JustTest.as_view()),
]
Define your view:
# your views.py
from django.views import View
from django.http.response import HttpResponse
from django_simple_api import Query
class JustTest(View):
def get(self, request, id: int = Query()):
return HttpResponse(id)
⚠️ To generate the document, you must declare the parameters according to the rules of Simple API (like the example above).
Click Declare parameters to see how to declare parameters.
Access interface document
After the above configuration, you can start your server and access the interface documentation now.
If your service is running locally, you can visit http://127.0.0.1:8000/docs/ to view your documentation.
More
For more tutorials, see Django Simple API.
Metadata
Release files for django-simple-api 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-simple-api-0.2.2.tar.gz | 676.5 kB | Without provenance | Details for django-simple-api-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_simple_api-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for django_simple_api-0.2.2-py3-none-any.whl |
Total release size: 1.4 MB
Release files / django-simple-api-0.2.2.tar.gz
| Download URL | django-simple-api-0.2.2.tar.gz |
|---|---|
| Size | 676.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb8fac7019bd80ea4af6f5fcb99e07cb233bd9678ae0ad92e422f7b465dc3b6c
|
|
BLAKE2b-256 checksum How to use checksums |
4e51e1d9667b1c76f5f1108d6e087278e293762ccd04c6ac9f26d17b751bc8a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.3
|
Release files / django_simple_api-0.2.2-py3-none-any.whl
| Download URL | django_simple_api-0.2.2-py3-none-any.whl |
|---|---|
| Size | 684.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1d93f0e8f69dcfbaf72902569da3fd1db63f2080bc843e8fcca3a3551cdaf34
|
|
BLAKE2b-256 checksum How to use checksums |
be885a0cb4be7c2c603715ad7a280d32138a4833a1b068748f95ea9740c29582
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.3
|
Security for django-simple-api 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.