[Fixed]-Unable to upload image using shell in django

1👍

Try this

from django.core.files import File

a.headshot.save('abc.jpg', File(open('/tmp/pic.jpg', 'r')))

0👍

FileNotFoundError: [Errno 2] No such file or directory: '/pyproject/mysite/tmp/pic.jpg'

Just see where python is looking for the file.

Please copy the pic.jpg file in same directory where you are running shell command it will work for sure then.

Leave a comment