Search code examples
django-rest-frameworkswagger-uidjango-rest-swagger

Add Base Url to Django Rest Swagger


I can't find a way to add the BASE URL to the django rest swagger. I tried adding

SWAGGER_SETTINGS = {
    "base_path": 'localhost:62090/',
}

to settings.py. But its not working.


Solution

  • I couldn't find a way to display the base url in the swagger ui, but I could add the base url like this in urls.py

    schema_view = get_swagger_view(title='Pastebin API',url='/pastebin/')
    

    This code adds the base url between the host and the url u specified.