Home > Software design >  What's the difference between MEDIA_ROOT = BASE_DIR / 'media'` and MEDIA_ROOT= os.pat
What's the difference between MEDIA_ROOT = BASE_DIR / 'media'` and MEDIA_ROOT= os.pat

Time:05-19

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.

CodePudding user response:

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

CodePudding user response:

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?

  • Related