'What's the difference between MEDIA_ROOT = BASE_DIR / 'media'` and MEDIA_ROOT= os.path.join(BASE_DIR, "media") in Django setting.py

I wanted to know the difference between using MEDIA_ROOT = BASE_DIR / 'media' and MEDIA_ROOT= os.path.join(BASE_DIR, "media") in settings.py.



Solution 1:[1]

Those are basically the same, but only if BASE_DIR is a pathlib.Path object.

Solution 2:[2]

MEDIA_ROOT = BASE_DIR / 'media'

utilizes pathlib library

MEDIA_ROOT = os.path.join(BASE_DIR, "media")

utilizes os library

The default library depends on which version of Django you employ.

What do you mean by deleting and uploading can you give more detail?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erik Kalkoken
Solution 2 tealy