-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Closed
Description
my situation is something like this:
api.py
def blueprint_maker(bpname, db_session):
api = Blueprint(bpname, __name__)
[...]
@api.route('/ping', methods=['GET'])
def ping():
response = {
'data': [{
'echo': 'echo!',
'source': url_for('api.ping')
}]
}
return jsonify(response)
return apiand then:
main.py
[snip]
ar = blueprint_maker('ar', SessionLocal_ar)
uy = blueprint_maker('uy', SessionLocal_uy)
br = blueprint_maker('uy', SessionLocal_br)
pt = blueprint_maker('uy', SessionLocal_pt)
[...]
app.register_blueprint(ar, url_prefix='/ar')
app.register_blueprint(uy, url_prefix='/uy')
app.register_blueprint(ar, url_prefix='/br')
app.register_blueprint(uy, url_prefix='/pt')
[...]I expected url_for() to just work in this scenario, but instead, it gives me:
Could not build url for endpoint 'api.ping'. Did you mean 'ar.ping' instead?
isn't this supposed to work?
Environment:
- Python version: 3.9
- Flask version: 2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels