5
I got the same error and debugged it using the shell
In your settings.py
file:
Change:
MEDIA_ROOT = BASE_DIR / '/media/'
# here, MEDIA_ROOT = '/media/'
To:
MEDIA_ROOT = BASE_DIR / 'media/'
# here, MEDIA_ROOT = 'path-to-project/media/'
I think this happens because you are trying to join your project level dir
to the /media/
directory that exists in linux for mounting media. And would cause permission denied because root
has the write permissions, you probably arenβt running everything with sudo
. So, instead you can remove the first \
to make the directory relative.
3
mkdir --mode=777 -pv /home/rahul/.local/share/virtualenvs/music-69qL54Ia/{admin/main/artist/1/change,media/artists}
chmod -R 777 /home/rahul/.local/share/virtualenvs/music-69qL54Ia
- [Django]-How do you produce/create tables in Geraldo Reports?
- [Django]-Authenticate() function not working django.contrib.auth
- [Django]-Python catch previous exception in broad handler
1
Maybe you forgot to add the MEDIA_ROOT to your urls.py.
For more info checkout the docs
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Note: This is not suitable for production use. if thats the case you can checkout the docs
Source:stackexchange.com