Отсутствуют статические файлы url фреймворка Django Rest?

У меня есть api с rest framework, но в поле img отсутствует host url .ex:localhost:...

В поле img должно быть указано localhost: ... / images / ...

Но у него есть только /images/...

Как я могу изменить его на 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

Вернуться на верх