[Answered ]-Absolute path? `upload_to` of models.FileFIeld

1๐Ÿ‘

โœ…

The MEDIA_ROOT setting [Django-doc] specifies the:

Absolute filesystem path to the directory that will hold user-uploaded files.

You thus should specify with this setting where you will store the media files. If MEDIA_ROOT is thus /, then it will store these in the /_mat/ directory of the server.

You thus can set the MEDIA_ROOT setting to:

# settings.py

# โ‹ฎ,

MEDIA_ROOT = '/var/www/html/myproj/'

# โ‹ฎ

0๐Ÿ‘

permission denied i think come from ubuntu file system it self
so you can run

sudo chmod -R 755 /var/www/html/myproj/_mat/

and it is better also to make user of Nginx is same as gunicorn and give this user access to your media
as follow let your user is user1

sudo chown -R user1:user1 /var/www/html/myproj/_mat/

Leave a comment