title: How do I get the server name in Django for a complete url?
body: <p>I'm using django templates to create an e-mail. I do something like this:</p>
  
  <pre><code>msg_html = render_to_string('email/%s.html' % template_name, context)
  msg = EmailMultiAlternatives(subject, msg_text, from_email, to_list)
  msg.attach_alternative(msg_html, "text/html")
  msg.content_subtype = "html"
  msg.send()
  </code></pre>
  
  <p>My template uses named url patterns like so:
      {% url url_name parameter %}</p>
  
  <p>Which works fine, except it will render a relative url, like: 
      /app_name/url_node/parameter</p>
  
  <p>Usually that is enough, but since this is an e-mail I really need it to be a full url - with the server name prepended, like: 
      <a href="http://localhost:8000/app_name/url_node/parameter" rel="noreferrer">http://localhost:8000/app_name/url_node/parameter</a>.</p>
  
  <p>How can I do this? How do I dynamically get the server name? (I don't want to hardcode it for sure).</p>
  
  <p>Another way of asking:  how do I get HttpServletRequest.getContextPath() ala Java, but instead in Django/Python?</p>
  
  <p>thanks</p>