It may look very odd, but this is what I want to achieve exactly, it is not related with blueprints or add prefix to all routers. thanks!
Asked
Active
Viewed 278 times
1 Answers
1
You can define your own:
# url_for_custom.py
import flask
def url_for(endpoint, **values):
url = flask.url_for(endpoint, **values)
if not values.get('_external', False):
url = '/foo' + url
return url
If you wish to change it globally, you can monkey-patch some time early on:
# __init__.py
import flask
from url_for_custom import url_for
flask.url_for = url_for
Although it's perhaps better to simply import and use your own implementation.

dmitrybelyakov
- 3,709
- 2
- 22
- 26