Description
I'm using a swagger ui generated from the swagger-ui repo. I've created a static folder, into which I've put the dist css and js, and I've made a templates folder, into which I've copied the index.html, and renamed it as swagger-ui.html.
My main file looks like this:
api_blueprint = Blueprint("api", __name__, url_prefix="/api")
# say documentation should be at /api/doc
api = Api(api_blueprint)
app.register_blueprint(api_blueprint)
# register the blueprint
# initialise all of the api routes
initialise_routes(api)
@api.documentation
def custom_ui():
return apidoc.ui_for(api)
Inside the template, I'm trying to reference specs_url and title, which I'm meant to get from the apidoc._ui_for function.
Unfortunately, it can't find those variables, and when I try to print specs_url the error says:
'Attempted to generate a URL without the application context being pushed'.
What I'm trying to do is be able to create my own swagger ui and get flask-restx to use that, rather than the default swagger ui in the library code. The documentation is minimal for doing this, so I'd really appreciate if someone could explain how it can be done.