[Django]-Django get media directories in view or model

3👍

To answer the question you actually asked, you can access your MEDIA_ROOT setting (and any other Django settings) in your views and models with:

settings.MEDIA_ROOT

As mentioned however, you probably want to read up on how media is handled in Django first.

Read about using settings in python code in the docs.

0👍

I figured it out!

You can access like this


modelName.fieldName.field.upload_to

Leave a comment