-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indicate Base URL in Swagger UI #286
Comments
Hi ! By default, when using this pattern (ie. with You have multiple possibilities: Use a blueprint to change the API rootIf you want to keep the documentation on the API root but change the API root, use a blueprint to register you API where you want. from flask import Flask, Blueprint
from flask_restplus import Api
app = Flask(__name__)
blueprint = Blueprint('api', __name__, url_prefix='/test')
api = Api(blueprint)
app.register_blueprint(blueprint)
assert url_for('api.doc') == '/test/' Only change the documentation locationIf you want to keep the API root at the same place but only move the documentation location, Flask-restplus allows you to specify it with the doc parameter. from flask import Flask
from flask_restplus import Api
app = Flask(__name__)
api = Api(app, doc='/test/')
assert url_for('doc') == '/test/' You can also combine both. See http://flask-restplus.readthedocs.io/en/stable/swagger.html#customization for more details on advanced documentation customization. |
Hello and thank you for your time and answer. So I have changed it as below:
I am facing the following error:
I'm not very familiar with the concept of application context but I'll investigate. In the meantime if you have any clue that would be of great help. Thank you |
Ok I've solved my issue by removing the call to url_for and proceeded as follow:
It seems to be working. Thanks a lot for the help! |
I did it like this and it works
|
Hello,
I've posted this question on Stackoverflow but did not manage to get an answer. For some reason I am not able to define the base URL in the Swagger UI documentation. It show "BASE URL: /" as described here:
http://stackoverflow.com/questions/43632686/how-to-indicate-base-url-in-flask-restplus-documentation
Is it a bug or am I doing something wrong?
Thank you
Alexis
The text was updated successfully, but these errors were encountered: