- 
                Notifications
    You must be signed in to change notification settings 
- Fork 438
Open
Labels
questionQuestionQuestion
Description
Bug Report
Description
Cannot change the base API URL for Swagger. Tried to set it via settings.py and in the arguments of the get_schema_view function:
SWAGGER_SETTINGS = {
    'DEFAULT_API_URL': 'http://localhost:8000/',
}
schema_view = get_schema_view(
   openapi.Info(
        title='Snippets API',
        default_version='v1',
        description='Test description',
        contact=openapi.Contact(email='<email>'),
        license=openapi.License(name='MIT License'),
    ),
    public=True,
    permission_classes=(permissions.AllowAny,),
    url='http://localhost:8000/',
)
The API URL displayed on the Swagger page did not change after these actions.
The issue was resolved only after I added an API endpoint to the root urlconf, ensuring its URI and the URIs of other endpoints do not intersect.
urlpatterns = [
    # Docs
    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'),
    # Django admin
    path('admin/', admin.site.urls),
    # API endpoints of users app
    path('api/users/', include('users.urls')),
    path('health', test_view)
]
Metadata
Metadata
Assignees
Labels
questionQuestionQuestion

