Sunday, February 26, 2017

Django runserver - can't serve video files

Leave a Comment

When running Django in local mode using the runserver command video files are not loaded in the browser properly. I get the error

An error occurred trying to load the resource.

All other static files serve fine such as images, javascript and css.

3 Answers

Answers 1

I have found the answer finally, Django's runserver does not support byte range requests. See this thread:

https://groups.google.com/forum/#!msg/django-developers/NZ1qTkZ6vok/fhdz7rTtL1EJ

And this ticket:

https://code.djangoproject.com/ticket/22479

Answers 2

Try running

python manage.py collectstatic 

Of course you must have STATIC_ROOT and STATICFILES_DIRS set properly in your settings file.

Answers 3

You may want to try and change your <video> tags to <source> as follows:

<source src="{{ YOUR_MEDIA_FILE_URL }}*yourvideo*.*videoformat*" type="video/*videoformat*"></source>

  • YOUR_MEDIA_FILE_URL: Works like the STATIC_URL documented examples.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment