I have a problem serving MP4 and WEBM files in production. Everything works fine in development. I’m using a hosted server at Rochen which I’m pretty sure is a linux virtual server - uses wsgi.py.
The video files are static files used in my home page and my help pages, embedded in the html. On the same html pages and in the same static folder are some gif files. The gif files display ok, but the video files give a 500 error in the browser and a “io.UnsupportedOperation: fileno” in the stderr.log
Extracts of the html are:
<div class="col-md-6 embed-responsive embed-responsive-4by3">
<video class="border border-dark col-12 rounded-3 shadow" controls>
<source src="{% static '/aerocoach/assets/home/home_01.mp4' %}" type="video/mp4"/>
</video>
</div>
Some of the relevant settings:
DEBUG = True
BASE_DIR = Path(file).resolve().parent.parent
MIDDLEWARE = [
“whitenoise.middleware.WhiteNoiseMiddleware”,
“django.middleware.security.SecurityMiddleware”
STATIC_ROOT = BASE_DIR / “staticfiles”
STATIC_URL = “static/”
STATICFILES_STORAGE = “whitenoise.storage.CompressedManifestStaticFilesStorage”
Myhome page shows the gif and the mp4 embedded.
"https://aerocoach.net"
GIF displays in a separate tab, but the mp4 doesn’t.
"https://aerocoach.net/static/aerocoach/assets/home/home_01.mp4"
If I put in a wrong file name, then I get a django debug screen.
"https://aerocoach.net/static/aerocoach/assets/home/home_011.mp4"
Django appears to be finding the mp4 file, but not rendering it. Is whitenoise corrupting the file?