Reputation: 605
I am learning flask to create endpoints using flask-restful and flask-sqlalchemy.
There is one configuration property named testing
in the flask.
Is there any way in flask-restful or in the flask, using that we can create an endpoint that will only available if testing
config property of flask app is true.
Upvotes: 0
Views: 297
Reputation: 24966
Take advantage of the flexibility that Python provides.
if app.testing:
@app.route('/only-for-testing')
def only_for_testing():
...
Upvotes: 2