django data shows all but images

62 Views Asked by At

My product card: product name and price shows but not image

    <Card>
     
        <Card.Img src={product.image_one} />
      
      <Card.Body>
        
          <Card.Title as="div">
            <strong>{product.name}</strong>
          </Card.Title>
        
        <Card.Text>${product.price}</Card.Text>
      </Card.Body>
    </Card>

My settings.py:

STATIC_URL = '/static/'
MEDIA_URL = '/images/'

STATICFILES_DIRS = [
    BASE_DIR / 'static'
]

MEDIA_ROOT = 'static/images'

My urls.py:

from django.contrib import admin
from django.urls import path, include

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include('core.urls'))
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

The image shows when i enter in the image url in replace of the image_one props. What am i doing wrong?

0

There are 0 best solutions below