I am writing a rest api application in the django rest framework in which I can post images.
I want to receive the url of the image: https://path/image_name.jpg
Here is my serializer class:
class Serializer(serializers.ModelSerializer):
url = serializers.SerializerMethodField('get_image_url')
...
def get_image_url(self, obj):
return obj.image.url
In this case /media/filename.jpg is returned
If I add the https prefix, the link will be displayed, but if I click on it I get an error: browser can not connect to the server localhost