Django Rest framework url static files missing?

I got an api with rest framework but the field img missing the host url .ex:localhost:...

The img field should have localhost: ... / images / ...

But it only has /images/..

How can I change it to urlhost/images/..

Models.py

class Product(models.Model):
    id = models.AutoField(db_column='ID', primary_key=True)  # Field name made lowercase.
    productcode = models.CharField(db_column='ProductCode', max_length=200, blank=True, null=True)  # Field name made lowercase.
    name = models.CharField(db_column='Name', max_length=200)  # Field name made lowercase.
    price = models.FloatField(db_column='Price')  # Field name made lowercase.
    img = models.FileField(db_column='IMG', max_length=200)  # Field name made lowercase.
    description = models.CharField(db_column='Description', max_length=2000, blank=True, null=True)  # Field name made lowercase.
    stock = models.IntegerField(db_column='Stock')  # Field name made lowercase.
    createdate = models.DateField(db_column='CreateDate',default=dateupdate())  # Field name made lowercase.
    brandname = models.ForeignKey(Brand, models.DO_NOTHING, db_column='BrandName')  # Field name made lowercase.

Views.py

@api_view(['GET'])
def CartdetailsView(request):
    username = request.user.username
    queryset = Cartdetails.objects.filter(username=username)
    serializer = CartdetailsSerializer(queryset,many=True)
    return Response(serializer.data)

ProductAPI

Back to Top