Open HendrikPN opened 5 years ago
Maybe it's sufficient to put Pillow==6.0.0
in requirements.txt
Maybe it's sufficient to put
Pillow==6.0.0
inrequirements.txt
This is unimportant. As long as some version is installed, it is all good.
But now it cannot find the images anymore:
"GET /static/code/scigym/files/images/b479c625-cc8f-49ac-8a1a-f580f9af9bd5.png HTTP/1.1" 404 1933
Okay. It is actually my fault:
I used the frontend to determine the upload URL of the images from the file path. That is, the file path is e.g. code/scigym/files/images/img.png
which is actually new since #17 since the BASE_DIR changed to code/scigym
. The corresponding url would be localhost:8000/static/images/img.png
. So we should remove code/scigym/files/
from the file path in the frontend. However, before the changes in #17 the file path would have been code/files/images/img.png
so it only removed code/files/
which of course does not work.
Instead, we should do this now in the backend, i.e. use a new field download_path
for this. This would be in accordance to having a single source of truth.
heroku still fails to upload image:
django.db.utils.ProgrammingError: column images_image.upload_path does not exist
LINE 1: ...images_image"."name", "images_image"."file_path", "images_im...
https://github.com/HendrikPN/scigym-api/issues/24#issuecomment-508539823
Solved this. Had to apply heroku run:detached python manage.py migrate
Still bug: Now there is nothing in the logs when an image is posted. It just throws an error... @erik-sn Do you have any idea why this still fails in heroku but works perfectly fine locally?
UPDATE: It seems that every time I deploy it is missing the module PIL
despite it being in the requirements.txt
.
So it seems that the image is being saved here and I can even verify that it exists right after its creation. However, it seems to be deleted immediately after. That is, I can run heroku run:detached ls /app/scigym/files/images/
and not see any file there. It has just vanished even though I could verify its existence by running logger.info(os.path.exists(save_path))
right after this. Something is fishy.
no module named
PIL
infrom PIL import Image
. If the module is installed, the image can be created but cannot be accessed. This error appears since PR #17