Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 670
Sudaraka Jayathilaka Avatar asked Jan 03 '23 16:01

Sudaraka Jayathilaka


1 Answers

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.

like image 119
Sudaraka Jayathilaka Avatar answered Jan 13 '23 09:01

Sudaraka Jayathilaka