flask-restful-swagger
flask-restful-swagger copied to clipboard
How to customize swagger html
Hi.
In a project I want to customize the default swagger web interface. What's the easiest way to do it? I haven't found any documentation.
I could just edit the files in the static/ folder but I wanted to know if there's some mechanism like copying the static folder from this plugin to my root folder and just edit them there.
+1
I have a workaround: I was able to make a directory called swagger inside my flask app's static folder and put the static files from this project in there. Then to use them, you can change render_page function (like 175) to not include the base url. The specific line that needs to be changed is:
with open(os.path.join(rootPath, 'static', page), "r") as fs:
Change it to:
with open(os.path.join('static/swagger', page), "r") as fs:
However, you probably just want to include the rendering as part of your own project so it can have the same look and feel as the rest of your site.
If the workaround is effective, it may make sense to close this issue off. @nickvasilyev @hwdavidward @PabloCastellano Would you guys like to weigh in?