title: Media files not loading in email in Django
body: <p>I have a Django project deployed on Apache web server. I am serving my media files in folder <code>/var/www/media/</code>. My media files load okay when I am on my web application.</p>
  
  <p>I have a feature which sends email to different people. In that email those media files should load, but they show 404 error in console.</p>
  
  <p>This is what I added in my <strong>apache2.conf</strong> file:</p>
  
  <pre><code>WSGIScriptAlias / /home/search/egeirn/project/egeirn/wsgi.py
  WSGIPythonPath /home/search/egeirn/project:/home/search/virtualenvs/egerin/lib/python2.7/site-packages
  
  Alias /media/ /var/www/media/
  Alias /static/ /var/www/static/
  
  &lt;Directory /var/www/static&gt;
  Require all granted
  &lt;/Directory&gt;
  
  &lt;Directory /var/www/media&gt;
  Require all granted
  &lt;/Directory&gt;
  
  &lt;Directory /home/search/egeirn/project/egeirn&gt;
  &lt;Files wsgi.py&gt;
  Require all granted
  &lt;/Files&gt;
  &lt;/Directory&gt;
  </code></pre>
  
  <p>This is my <strong>base.py</strong> file:</p>
  
  <pre><code>...
  STATIC_URL = '/static/'
  STATIC_ROOT = '/var/www/static/'
  
  MEDIA_URL = '/media/'
  MEDIA_ROOT = '/var/www/media/'
  ...
  </code></pre>
  
  <p>This is my <strong>production.py</strong> file which is loaded in <strong>manage.py</strong> and <strong>wsgi.py</strong>:</p>
  
  <pre><code>from .base import *
  
  DEBUG = False
  
  ALLOWED_HOSTS = ['iro.egerin.com']
  
  MEDIA_URL = 'http://iro.egerin.com/media/'
  </code></pre>
  
  <p>Please tell what I should do to load my media files out of the application like in email?</p>
  
  <p><em>Just to give an idea this is the error in the console:</em></p>
  
  <p><a href="https://i.stack.imgur.com/FHlM0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FHlM0.jpg" alt="enter image description here"></a></p>