I have a flask app running in a docker container. All works fine, except when I want to do some manual jobs in the same docker container from flask shell. The problem is that the url_for(x, _external=True)
always returns https://localhost, doesn't matter how I try to set the server name in the shell.
I have obviously tried setting the SERVER_NAME to no change.
$ python manage.py shell
>>> from flask import current_app
>>> current_app.config['SERVER_NAME'] = 'example.com'
>>> from app import models
>>> models.Registration.send_registration(id=123)
The jinja template is having:
{{ url_for('main.index', _external=True, _scheme='https') }
}
Which generates: https://localhost
I would like to get: https://example.com
I am using Flask 0.11, Werkzeug 0.11.10 and Jinja2 2.8