Merge pull request #18 from AlekseyLobanov/feat_6

Feat 6
This commit was merged in pull request #18.
This commit is contained in:
Aleksey Lobanov
2021-04-14 13:37:40 +03:00
committed by GitHub
3 changed files with 28 additions and 1 deletions

View File

@@ -27,7 +27,8 @@ SECRET_KEY = "django-insecure-toz+*lt(ejm!l*)92w2ciqoh^1kz#a(abbpcn54-dbw(nxoy&7
DEBUG = True
ALLOWED_HOSTS = []
if DEBUG:
ALLOWED_HOSTS = ["0.0.0.0"]
# Application definition
@@ -40,8 +41,19 @@ INSTALLED_APPS = [
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
"drf_yasg",
]
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'Bearer': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header'
}
}
}
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",

View File

@@ -6,8 +6,21 @@ from rest_framework_simplejwt.views import (
TokenRefreshView,
)
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from .api import router
schema_view = get_schema_view(
openapi.Info(
title="ToDo List",
default_version='v1',
description="Swagger Interface for ToDo List",
),
public=True,
permission_classes=(permissions.AllowAny,),
)
urlpatterns = [
path("admin/", admin.site.urls),
@@ -15,4 +28,5 @@ urlpatterns = [
path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
path("api/", include(router.urls)),
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
]

View File

@@ -21,3 +21,4 @@ toml==0.10.2
urllib3==1.26.4
djangorestframework-simplejwt==4.6.0
psycopg2-binary>=2.8
drf-yasg==1.20.0