why does mediaroot not work with django production?

There’s nothing wrong with those variables in particular. The fact is you never want to serve static files using Django’s dev server in production, both because of performance and security issues.

The dev server is very helpful, because it allows you to use nothing but Django to serve static files and media files during development, but it is not a production web server in any way (such as Nginx for example).

The docs are, as always, helpful: https://docs.djangoproject.com/en/3.1/howto/static-files/#serving-uploaded-files-in-development

What applies to static files also applies to media files. For strategies about static files deployment, there’s a whole page on the docs too.

Some packages, such as Whitenoise, help when dealing with static files in production, but Whitenoise can’t be used for media (user-uploaded) static files (because roughly it discovers static files at start).

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top