Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions auth_system/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,38 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'drf_spectacular',
'users',
]

# REST Framework settings
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
}

# Spectacular settings
SPECTACULAR_SETTINGS = {
'TITLE': 'Authentication System API',
'DESCRIPTION': 'API for user authentication and management',
'VERSION': '1.0.0',
'SERVE_INCLUDE_SCHEMA': False,
'COMPONENT_SPLIT_REQUEST': True,
'SECURITY': [
{
'Bearer': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header',
'description': 'Enter your JWT token in the format: Bearer <token>'
}
}
],
}

# Custom User model
AUTH_USER_MODEL = 'users.User'

Expand Down
8 changes: 7 additions & 1 deletion auth_system/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView

urlpatterns = [
path('admin/', admin.site.urls),

# API Documentation URLs
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/docs/swagger/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('api/docs/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
]
Loading