Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 378 characters in body
Source Link
Sanip
  • 1.8k
  • 1
  • 19
  • 29

The problem isMake sure you have maintained the media file settings. In your settings.py file:

MEDIA_URL = '/media/' MEDIA_ROOT= os.path.join(os.path.dirname(BASE_DIR), "media_root") 

Then in your main urls.py:

urlpatterns = patterns('', # ... the rest of your URLconf goes here ... ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 

Then make changes in your html file:

<source src="{% static 'deploy/object.videofile' %}" type='video/mp4'> //here 

You are trying to fetch the video file as an static file. This is not the correct approach.

Try passing the url of the object's video file in the src of the video as:

<br><br> <video width='400' controls> <source src="{{ object.videofile.url }}" type='video/mp4'> Your browser does not support the video tag. </video> <br><br> 

The problem is in your html file:

<source src="{% static 'deploy/object.videofile' %}" type='video/mp4'> //here 

You are trying to fetch the video file as an static file. This is not the correct approach.

Try passing the url of the object's video file in the src of the video as:

<br><br> <video width='400' controls> <source src="{{ object.videofile.url }}" type='video/mp4'> Your browser does not support the video tag. </video> <br><br> 

Make sure you have maintained the media file settings. In your settings.py file:

MEDIA_URL = '/media/' MEDIA_ROOT= os.path.join(os.path.dirname(BASE_DIR), "media_root") 

Then in your main urls.py:

urlpatterns = patterns('', # ... the rest of your URLconf goes here ... ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 

Then make changes in your html file:

<source src="{% static 'deploy/object.videofile' %}" type='video/mp4'> //here 

You are trying to fetch the video file as an static file. This is not the correct approach.

Try passing the url of the object's video file in the src of the video as:

<br><br> <video width='400' controls> <source src="{{ object.videofile.url }}" type='video/mp4'> Your browser does not support the video tag. </video> <br><br> 
Source Link
Sanip
  • 1.8k
  • 1
  • 19
  • 29

The problem is in your html file:

<source src="{% static 'deploy/object.videofile' %}" type='video/mp4'> //here 

You are trying to fetch the video file as an static file. This is not the correct approach.

Try passing the url of the object's video file in the src of the video as:

<br><br> <video width='400' controls> <source src="{{ object.videofile.url }}" type='video/mp4'> Your browser does not support the video tag. </video> <br><br>