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.
- [Django]-Django admin change-list optimizing query: select field1, field2 instead of select *
- [Django]-Django: No m2m_changed signal when one side of a many-to-many is deleted?
- [Django]-Django replica data save to many databases
Source:stackexchange.com