Media files are not loading properly when pulling from database. Although, when inspecting page, source seems to be correct.
I have preformed migrations, collectstatic. static files are loaded to the html file
settings.py
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
urls.py
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', cars.views.index_page, name='index_page'),]
urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
models.py
nuotrauka = models.ImageField(default='default.jpg', blank=True)
index.html
{% for detail in carDetails %}
<img src="{{detail.nuotrauka.url}}" alt="detail-image">
{% endfor %}
Image is simple not loading. It seems like image src is not able to locate the image or media folder is not being recognized at BASE_DIR. I might be just simple missing something but at this point I am not able to see it.
I do think it has something todo with folder structure and maybe even BASE_DIR. Because URL seem to be fine, but the file is not found