i have uploaded a video to django and it’s all working fine ..
but i need to render that video in the view..
django cant access it
any idea how to make django template see my uploaded files
modles.py :
class VideoData(models.Model):
title = models.CharField(max_length=200)
file = models.FileField(upload_to='vids' )
forms.py :
class UploadFileForm(forms.Form):
title = forms.CharField(max_length=50)
file = forms.FileField()
and in template.html:
<video width="320" height="240" controls="controls">
<source src="vids/name.mov" type="video/mov" />
</video>
it shows an empty video player.
am i doing anything wrong ?
please help
Assuming an instance of
VideoDatanamedvidis in the template’s context, you should use:To add the
VideoDatainstance to the template’s context, your view should look like this: