heroku-django-uploaded image is not displayed if DEBUG=False
<p>I deployed my Django app on heroku. Every thing is working fine except displaying images. Any uploaded image is not displayed if DEBUG=False.</p>

<p>settings.py</p>

<pre><code>DEBUG = False

ALLOWED_HOSTS = ['salma-blog.herokuapp.com']

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
STATIC_ROOT = os.path.dirname(myblog.__file__)+'/static/'
STATIC_URL = '/static/'

#upload images
MEDIA_ROOT= os.path.dirname(myblog.__file__)+'/static/myblog/images'
MEDIA_URL='/images/'
</code></pre>

<p>urls.py</p>

<pre><code>urlpatterns=[
   ...
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
</code></pre>

<p>image tag in my template</p>

<pre><code>&lt;img alt="img" src="/blog{{image}}"&gt;&lt;/a&gt;
</code></pre>

<p>Whitenoise uses <a href="http://whitenoise.evans.io/en/stable/django.html#WHITENOISE_USE_FINDERS" rel="nofollow">static file finders</a> when <code>DEBUG=True</code>, so you most likely have a problem with your static file collection process.</p>

<p>Update your <code>STATIC_ROOT</code> and <code>MEDIA_ROOT</code> settings to a recommended method, such as:</p>

<pre><code>STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'images')
</code></pre>

python django heroku