[Answered ]-Accessing Django MEDIA_URL and MEDIA_ROOT setting.py values from ReactJS frontend

2👍

You can use url property of file field.
If for example you have FileField ‘audio’ in your model you can try this to get file’s url:

{{ props.audio.url }}

But if you dont have model and in your view there is some variable contains file’s url ‘props.audio’ you can pass it from view to template:

def my_view(request):
    return render(request, 'template.html', {'props_url': props.audio})

Now in template to get url simple do following:

{{ props_url }}

Leave a comment