I know this is a prevalent topic, but I still have yet to find a recent answer that helps. I have setup my dev environment to serve MEDIA in what I believe is the correct way, but images are still not resolving. Paths being return propery in template, but I believe the issue is with URLS.PY? This is my settings.py:
if DEBUG:
#For local
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
if DEV:
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = 'http:/127.0.0.1:8000/admin-media/'
This is the template itself (attached image is the rendered template itself, which seems correct):
<div><img src="{{MEDIA_URL}}products/{{product.filename}}"></div>
This is my primary URLS.py (top level, not application specific, but I've added this line in the app specific one as well):
urlpatterns = [
url(r'^', include('drivel.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^tinymce/', include('tinymce.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
What am I missing? I am down to the wire and can't seem to get this going. I also am open to recos for the production site as I'm new to Django and best practices in production.
Environment is Py 2.7, Django 1.8.