Storage Backends - what are they?

We are revisiting static and media files as I realised the last post did not quite finish the subject well enough!

When deploying a project to a production environment, the main alteration in settings will switching the storage backend that will be used so Django understands what to do with media and static files.

For example when configuring Whitenoise the following storage backend needs to used:

    # ...
    "staticfiles": {
        "BACKEND": "",

Django Storages has a number of different options depending on the cloud provider you choose to use.

But what exactly is a storage backend? A storage backend provides a common API for Django to process and serve static and media files correctly depending on where they are stored. This included copying static files and media files to the correct place, handling the resolution of static tag to the correct url and the resolution or the .url attribute of FileFields and ImageFields.

Storage backends allow Django to support an infinite possible way of handling files without having to know about every type of situation within the core of Django itself.