title: Flask shell - how to set server name for url_for _external=True?
body: <p>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 <code>url_for(x, _external=True)</code> always returns <a href="https://localhost" rel="noreferrer">https://localhost</a>, 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.</p>
  
  <pre><code>$ python manage.py shell
  &gt;&gt;&gt; from flask import current_app
  &gt;&gt;&gt; current_app.config['SERVER_NAME'] = 'example.com'
  &gt;&gt;&gt; from app import models
  &gt;&gt;&gt; models.Registration.send_registration(id=123)
  </code></pre>
  
  <p>The jinja template is having:
  <code>{{ url_for('main.index', _external=True, _scheme='https') }</code>}</p>
  
  <p>Which generates:
  <a href="https://localhost" rel="noreferrer">https://localhost</a></p>
  
  <p>I would like to get:
  <a href="https://example.com" rel="noreferrer">https://example.com</a></p>
  
  <p>I am using Flask 0.11, Werkzeug 0.11.10 and Jinja2 2.8</p>