Open pwilczynskiclearcode opened 2 years ago
I have the same issue, becouse i have a load balancer and i want to serve swagger docs statics in api/v1/ this is solved or is a issue open? or do you have a some example
No. I didn't figure out the solution... You may try some monkey-patching like:
STATIC_URL_PATH = "/"
import flask_restx
from flask import url_for
flask_restx.apidoc.apidoc = flask_restx.apidoc.Apidoc(
"restx_doc",
__name__,
template_folder="templates",
static_folder="static",
static_url_path=STATIC_URL_PATH,
)
@flask_restx.apidoc.apidoc.add_app_template_global
def swagger_static(filename):
return url_for("restx_doc.static", filename=filename)
(I didn't verify this code)
actually i already tried that option and it works but i can't find a way to get it from code or replacing some decorator without having to go to the core of the library. for this solution i would have to be able to do a fork right? because I am not interested in having a new template but in using the original one from the library but served in my blueprint /api/v1/.
I wanted to serve swagger docs statics at different url prefix than
/swaggerui/
at the root. Currently it's hardcoded in https://github.com/python-restx/flask-restx/blob/master/flask_restx/apidoc.py#L24 making it impossible to serve it at e.g./api/swaggerui