Search code examples
pythondjangodjango-uploads

Serving Media in Production


This is well known topic, on how to setup, serve MEDIA Files, but there is a lot of no no to serving them in production, this is just one example from answered question on SO,

Django does not serve MEDIA_ROOT by default. That would be dangerous in production environment. But in development stage, we could cut short. Pay attention to the last line. That line enables Django to serve files from MEDIA_URL. This works only in developement stage

Obviously there is a lot of web application that are handling this, I have a field in which I'm expecting a lot of CV to be uploaded, my concern are corrupted files, so is there a common pattern on how to handle this?


Solution

  • What you are saying is recommended against, but if you would like to anyways, there is a package called dj-static that does exactly what you are asking.

    dj-static on Github