Skip to content

Commit

Permalink
Replace coreapi with drf-yasg
Browse files Browse the repository at this point in the history
  • Loading branch information
kalys committed Mar 9, 2024
1 parent 36d0a43 commit 852bd56
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ djangorestframework-simplejwt = "*"
djangorestframework = "*"
python-decouple = "*"
pytils = "*"
coreapi = "*"
cryptography = "*"
drf-yasg = "*"

[dev-packages]
factory-boy = "*"
Expand Down
180 changes: 83 additions & 97 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ashar_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
'rest_framework',
"corsheaders",
'django_rest_passwordreset',
'drf_yasg',
"allauth",
"allauth.account",
"allauth.socialaccount",
Expand Down
19 changes: 17 additions & 2 deletions ashar_app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
# from rest_framework.documentation import include_docs_urls

from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions

API_TITLE = 'Ashar API'
API_DESCRIPTION = 'Ashar API'
API_VERSION = '1.0.0'


schema_view = get_schema_view(
openapi.Info(
title=API_TITLE,
default_version=API_VERSION,
description=API_DESCRIPTION,
),
public=True,
permission_classes=(permissions.AllowAny,),
)

urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/accounts/', include('user.urls')),
path('api/v1/', include('term.urls')),
path('api/v1/likes/', include('like.urls')),
# path('docs/', include_docs_urls(title=API_TITLE, description=API_DESCRIPTION)),
path('social-accounts/', include('allauth.urls'), name='socialaccount_signup'),
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'),
]

if settings.DEBUG:
Expand Down

0 comments on commit 852bd56

Please sign in to comment.