Migrate to DRF-Spectacular instead of drf-yasg

This commit is contained in:
Keannu Bernasol 2023-07-25 15:12:53 +08:00
parent c955cadc18
commit 6af2bd0c0d
5 changed files with 1452 additions and 41 deletions

View file

@ -16,7 +16,7 @@ psycopg2 = "*"
gdal = {path = "./packages/GDAL-3.4.3-cp311-cp311-win_amd64.whl"}
django-leaflet = "*"
django-extra-fields = "*"
drf-yasg = "*"
drf-spectacular = "*"
[dev-packages]

145
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "fd5530e9030c9cd68dfa11602bce05b87958678435eadc6a0ade962791a4f82a"
"sha256": "2af7c1a36777c63d117eec851085d362eaaa1d3205b7780938bfb5e2e4133b69"
},
"pipfile-spec": 6,
"requires": {
@ -326,13 +326,13 @@
"index": "pypi",
"version": "==2.2.0"
},
"drf-yasg": {
"drf-spectacular": {
"hashes": [
"sha256:4c3b93068b3dfca6969ab111155e4dd6f7b2d680b98778de8fd460b7837bdb0d",
"sha256:f85642072c35e684356475781b7ecf5d218fff2c6185c040664dd49f0a4be181"
"sha256:8f5a8f87353d1bb8dcb3f3909b7109b2dcbe1d91f3e069409cf322963e140bd6",
"sha256:afeccc6533dcdb4e78afbfcc49f3c5e9c369aeb62f965e4d1a43b165449c147a"
],
"index": "pypi",
"version": "==1.21.7"
"version": "==0.26.4"
},
"gdal": {
"hashes": [
@ -371,6 +371,22 @@
"markers": "python_version >= '3.5'",
"version": "==0.5.1"
},
"jsonschema": {
"hashes": [
"sha256:971be834317c22daaa9132340a51c01b50910724082c2c1a2ac87eeec153a3fe",
"sha256:fb3642735399fa958c0d2aad7057901554596c63349f4f6b283c493cf692a25d"
],
"markers": "python_version >= '3.8'",
"version": "==4.18.4"
},
"jsonschema-specifications": {
"hashes": [
"sha256:05adf340b659828a004220a9613be00fa3f223f2b82002e273dee62fd50524b1",
"sha256:c91a50404e88a1f6ba40636778e2ee08f6e24c5613fe4c53ac24578a5a7f72bb"
],
"markers": "python_version >= '3.8'",
"version": "==2023.7.1"
},
"oauthlib": {
"hashes": [
"sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca",
@ -379,14 +395,6 @@
"markers": "python_version >= '3.6'",
"version": "==3.2.2"
},
"packaging": {
"hashes": [
"sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61",
"sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"
],
"markers": "python_version >= '3.7'",
"version": "==23.1"
},
"pillow": {
"hashes": [
"sha256:00e65f5e822decd501e374b0650146063fbb30a7264b4d2744bdd7b913e0cab5",
@ -574,6 +582,14 @@
"markers": "python_version >= '3.6'",
"version": "==6.0.1"
},
"referencing": {
"hashes": [
"sha256:47237742e990457f7512c7d27486394a9aadaf876cbfaa4be65b27b4f4d47c6b",
"sha256:c257b08a399b6c2f5a3510a50d28ab5dbc7bbde049bcaf954d43c446f83ab548"
],
"markers": "python_version >= '3.8'",
"version": "==0.30.0"
},
"requests": {
"hashes": [
"sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f",
@ -590,6 +606,109 @@
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.3.1"
},
"rpds-py": {
"hashes": [
"sha256:0173c0444bec0a3d7d848eaeca2d8bd32a1b43f3d3fde6617aac3731fa4be05f",
"sha256:01899794b654e616c8625b194ddd1e5b51ef5b60ed61baa7a2d9c2ad7b2a4238",
"sha256:02938432352359805b6da099c9c95c8a0547fe4b274ce8f1a91677401bb9a45f",
"sha256:03421628f0dc10a4119d714a17f646e2837126a25ac7a256bdf7c3943400f67f",
"sha256:03975db5f103997904c37e804e5f340c8fdabbb5883f26ee50a255d664eed58c",
"sha256:0766babfcf941db8607bdaf82569ec38107dbb03c7f0b72604a0b346b6eb3298",
"sha256:07e2c54bef6838fa44c48dfbc8234e8e2466d851124b551fc4e07a1cfeb37260",
"sha256:0836d71ca19071090d524739420a61580f3f894618d10b666cf3d9a1688355b1",
"sha256:095b460e117685867d45548fbd8598a8d9999227e9061ee7f012d9d264e6048d",
"sha256:0e7521f5af0233e89939ad626b15278c71b69dc1dfccaa7b97bd4cdf96536bb7",
"sha256:0f2996fbac8e0b77fd67102becb9229986396e051f33dbceada3debaacc7033f",
"sha256:1054a08e818f8e18910f1bee731583fe8f899b0a0a5044c6e680ceea34f93876",
"sha256:13b602dc3e8dff3063734f02dcf05111e887f301fdda74151a93dbbc249930fe",
"sha256:141acb9d4ccc04e704e5992d35472f78c35af047fa0cfae2923835d153f091be",
"sha256:14c408e9d1a80dcb45c05a5149e5961aadb912fff42ca1dd9b68c0044904eb32",
"sha256:159fba751a1e6b1c69244e23ba6c28f879a8758a3e992ed056d86d74a194a0f3",
"sha256:190ca6f55042ea4649ed19c9093a9be9d63cd8a97880106747d7147f88a49d18",
"sha256:196cb208825a8b9c8fc360dc0f87993b8b260038615230242bf18ec84447c08d",
"sha256:1fcdee18fea97238ed17ab6478c66b2095e4ae7177e35fb71fbe561a27adf620",
"sha256:207f57c402d1f8712618f737356e4b6f35253b6d20a324d9a47cb9f38ee43a6b",
"sha256:24a81c177379300220e907e9b864107614b144f6c2a15ed5c3450e19cf536fae",
"sha256:29cd8bfb2d716366a035913ced99188a79b623a3512292963d84d3e06e63b496",
"sha256:2d8b3b3a2ce0eaa00c5bbbb60b6713e94e7e0becab7b3db6c5c77f979e8ed1f1",
"sha256:35da5cc5cb37c04c4ee03128ad59b8c3941a1e5cd398d78c37f716f32a9b7f67",
"sha256:44659b1f326214950a8204a248ca6199535e73a694be8d3e0e869f820767f12f",
"sha256:47c5f58a8e0c2c920cc7783113df2fc4ff12bf3a411d985012f145e9242a2764",
"sha256:4bd4dc3602370679c2dfb818d9c97b1137d4dd412230cfecd3c66a1bf388a196",
"sha256:4ea6b73c22d8182dff91155af018b11aac9ff7eca085750455c5990cb1cfae6e",
"sha256:50025635ba8b629a86d9d5474e650da304cb46bbb4d18690532dd79341467846",
"sha256:517cbf6e67ae3623c5127206489d69eb2bdb27239a3c3cc559350ef52a3bbf0b",
"sha256:5855c85eb8b8a968a74dc7fb014c9166a05e7e7a8377fb91d78512900aadd13d",
"sha256:5a46859d7f947061b4010e554ccd1791467d1b1759f2dc2ec9055fa239f1bc26",
"sha256:65a0583c43d9f22cb2130c7b110e695fff834fd5e832a776a107197e59a1898e",
"sha256:674c704605092e3ebbbd13687b09c9f78c362a4bc710343efe37a91457123044",
"sha256:682726178138ea45a0766907957b60f3a1bf3acdf212436be9733f28b6c5af3c",
"sha256:686ba516e02db6d6f8c279d1641f7067ebb5dc58b1d0536c4aaebb7bf01cdc5d",
"sha256:6a5d3fbd02efd9cf6a8ffc2f17b53a33542f6b154e88dd7b42ef4a4c0700fdad",
"sha256:6aa8326a4a608e1c28da191edd7c924dff445251b94653988efb059b16577a4d",
"sha256:700375326ed641f3d9d32060a91513ad668bcb7e2cffb18415c399acb25de2ab",
"sha256:71f2f7715935a61fa3e4ae91d91b67e571aeb5cb5d10331ab681256bda2ad920",
"sha256:745f5a43fdd7d6d25a53ab1a99979e7f8ea419dfefebcab0a5a1e9095490ee5e",
"sha256:79f594919d2c1a0cc17d1988a6adaf9a2f000d2e1048f71f298b056b1018e872",
"sha256:7d68dc8acded354c972116f59b5eb2e5864432948e098c19fe6994926d8e15c3",
"sha256:7f67da97f5b9eac838b6980fc6da268622e91f8960e083a34533ca710bec8611",
"sha256:83b32f0940adec65099f3b1c215ef7f1d025d13ff947975a055989cb7fd019a4",
"sha256:876bf9ed62323bc7dcfc261dbc5572c996ef26fe6406b0ff985cbcf460fc8a4c",
"sha256:890ba852c16ace6ed9f90e8670f2c1c178d96510a21b06d2fa12d8783a905193",
"sha256:8b08605d248b974eb02f40bdcd1a35d3924c83a2a5e8f5d0fa5af852c4d960af",
"sha256:8b2eb034c94b0b96d5eddb290b7b5198460e2d5d0c421751713953a9c4e47d10",
"sha256:8b9ec12ad5f0a4625db34db7e0005be2632c1013b253a4a60e8302ad4d462afd",
"sha256:8c8d7594e38cf98d8a7df25b440f684b510cf4627fe038c297a87496d10a174f",
"sha256:8d3335c03100a073883857e91db9f2e0ef8a1cf42dc0369cbb9151c149dbbc1b",
"sha256:8d70e8f14900f2657c249ea4def963bed86a29b81f81f5b76b5a9215680de945",
"sha256:9039a11bca3c41be5a58282ed81ae422fa680409022b996032a43badef2a3752",
"sha256:91378d9f4151adc223d584489591dbb79f78814c0734a7c3bfa9c9e09978121c",
"sha256:9251eb8aa82e6cf88510530b29eef4fac825a2b709baf5b94a6094894f252387",
"sha256:933a7d5cd4b84f959aedeb84f2030f0a01d63ae6cf256629af3081cf3e3426e8",
"sha256:978fa96dbb005d599ec4fd9ed301b1cc45f1a8f7982d4793faf20b404b56677d",
"sha256:987b06d1cdb28f88a42e4fb8a87f094e43f3c435ed8e486533aea0bf2e53d931",
"sha256:99b1c16f732b3a9971406fbfe18468592c5a3529585a45a35adbc1389a529a03",
"sha256:99e7c4bb27ff1aab90dcc3e9d37ee5af0231ed98d99cb6f5250de28889a3d502",
"sha256:9c439fd54b2b9053717cca3de9583be6584b384d88d045f97d409f0ca867d80f",
"sha256:9ea4d00850ef1e917815e59b078ecb338f6a8efda23369677c54a5825dbebb55",
"sha256:9f30d205755566a25f2ae0382944fcae2f350500ae4df4e795efa9e850821d82",
"sha256:a06418fe1155e72e16dddc68bb3780ae44cebb2912fbd8bb6ff9161de56e1798",
"sha256:a0805911caedfe2736935250be5008b261f10a729a303f676d3d5fea6900c96a",
"sha256:a1f044792e1adcea82468a72310c66a7f08728d72a244730d14880cd1dabe36b",
"sha256:a216b26e5af0a8e265d4efd65d3bcec5fba6b26909014effe20cd302fd1138fa",
"sha256:a987578ac5214f18b99d1f2a3851cba5b09f4a689818a106c23dbad0dfeb760f",
"sha256:aad51239bee6bff6823bbbdc8ad85136c6125542bbc609e035ab98ca1e32a192",
"sha256:ab2299e3f92aa5417d5e16bb45bb4586171c1327568f638e8453c9f8d9e0f020",
"sha256:ab6919a09c055c9b092798ce18c6c4adf49d24d4d9e43a92b257e3f2548231e7",
"sha256:b0c43f8ae8f6be1d605b0465671124aa8d6a0e40f1fb81dcea28b7e3d87ca1e1",
"sha256:b1440c291db3f98a914e1afd9d6541e8fc60b4c3aab1a9008d03da4651e67386",
"sha256:b52e7c5ae35b00566d244ffefba0f46bb6bec749a50412acf42b1c3f402e2c90",
"sha256:bf4151acb541b6e895354f6ff9ac06995ad9e4175cbc6d30aaed08856558201f",
"sha256:c27ee01a6c3223025f4badd533bea5e87c988cb0ba2811b690395dfe16088cfe",
"sha256:c545d9d14d47be716495076b659db179206e3fd997769bc01e2d550eeb685596",
"sha256:c5934e2833afeaf36bd1eadb57256239785f5af0220ed8d21c2896ec4d3a765f",
"sha256:c7671d45530fcb6d5e22fd40c97e1e1e01965fc298cbda523bb640f3d923b387",
"sha256:c861a7e4aef15ff91233751619ce3a3d2b9e5877e0fcd76f9ea4f6847183aa16",
"sha256:d25b1c1096ef0447355f7293fbe9ad740f7c47ae032c2884113f8e87660d8f6e",
"sha256:d55777a80f78dd09410bd84ff8c95ee05519f41113b2df90a69622f5540c4f8b",
"sha256:d576c3ef8c7b2d560e301eb33891d1944d965a4d7a2eacb6332eee8a71827db6",
"sha256:dd9da77c6ec1f258387957b754f0df60766ac23ed698b61941ba9acccd3284d1",
"sha256:de0b6eceb46141984671802d412568d22c6bacc9b230174f9e55fc72ef4f57de",
"sha256:e07e5dbf8a83c66783a9fe2d4566968ea8c161199680e8ad38d53e075df5f0d0",
"sha256:e564d2238512c5ef5e9d79338ab77f1cbbda6c2d541ad41b2af445fb200385e3",
"sha256:ed89861ee8c8c47d6beb742a602f912b1bb64f598b1e2f3d758948721d44d468",
"sha256:ef1f08f2a924837e112cba2953e15aacfccbbfcd773b4b9b4723f8f2ddded08e",
"sha256:f411330a6376fb50e5b7a3e66894e4a39e60ca2e17dce258d53768fea06a37bd",
"sha256:f68996a3b3dc9335037f82754f9cdbe3a95db42bde571d8c3be26cc6245f2324",
"sha256:f7fdf55283ad38c33e35e2855565361f4bf0abd02470b8ab28d499c663bc5d7c",
"sha256:f963c6b1218b96db85fc37a9f0851eaf8b9040aa46dec112611697a7023da535",
"sha256:fa2818759aba55df50592ecbc95ebcdc99917fa7b55cc6796235b04193eb3c55",
"sha256:fae5cb554b604b3f9e2c608241b5d8d303e410d7dfb6d397c335f983495ce7f6",
"sha256:fb39aca7a64ad0c9490adfa719dbeeb87d13be137ca189d2564e596f8ba32c07"
],
"markers": "python_version >= '3.8'",
"version": "==0.9.2"
},
"service-identity": {
"hashes": [
"sha256:87415a691d52fcad954a500cb81f424d0273f8e7e3ee7d766128f4575080f383",

View file

@ -29,9 +29,19 @@ SECRET_KEY = str(os.getenv('SECRET_KEY'))
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
FRONTEND_DEBUG = True
FRONTEND_DEBUG = False
ALLOWED_HOSTS = ['*', '127.0.0.1', 'localhost', '10.0.10.32', '10.0.10.8']
ALLOWED_HOSTS = ['*']
CSRF_TRUSTED_ORIGINS = ["https://stude.keannu1.duckdns.org"]
# DRF-Spectacular
SPECTACULAR_SETTINGS = {
'TITLE': 'StudE API',
'DESCRIPTION': 'A Capstone project',
'VERSION': '1.0.0',
'SERVE_INCLUDE_SCHEMA': False,
# OTHER SETTINGS
}
# Email credentials
EMAIL_HOST = ''
@ -76,7 +86,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'drf_yasg',
'drf_spectacular',
'django.contrib.gis',
'rest_framework',
'rest_framework_simplejwt',
@ -133,7 +143,8 @@ TEMPLATES = [
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
)
),
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}
WSGI_APPLICATION = 'config.wsgi.application'

View file

@ -18,30 +18,13 @@ from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.urls import re_path
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="StudE API",
default_version='v1',
description="StudE Endpoints",
terms_of_service="https://www.google.com/policies/terms/",
contact=openapi.Contact(email="noehbernasol0@gmail.com"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
urlpatterns = [
path('schema/', SpectacularAPIView.as_view(), name='schema'),
path('swagger/',
SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('redoc/',
SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
path('admin/', admin.site.urls),
path('api/v1/', include('api.urls')),
path('swagger<format>/', schema_view.without_ui(cache_timeout=0),
name='schema-json'),
path('swagger/', schema_view.with_ui('swagger',
cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc',
cache_timeout=0), name='schema-redoc'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

1298
stude/schema.yml Normal file

File diff suppressed because it is too large Load diff