In this article, I would like to write about the error that I actually suffered when reflecting "Image Field" through a solution.
kadaikun.Image.image: (fields.E210) Cannot use ImageField because Pillow is not installed.HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow" At first I was plagued by this error. I installed pillow, but I was told that it was not installed and it was in a "?" State. For the time being, I tried to deal with it with the following command.
terminal
$ python3 -m pip uninstall pillow
$ python3 -m pip install pillow
And my great.
terminal
$ python manage.py migrate
result...
terminal
kadaikun.Image.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow"
It was bad....
At this time, I realized that I was using Docker ...
This was my first time using Docker, so I only knew if I should change the "Dockerfile" or "requirementes.txt".
For that reason, I wrote everything that came out googled into the Dockerfile from one end and repeated "docker-compose up" all the time.
/bin/sh: 1: apk: not found
The result of repeating ...
terminal
/bin/sh: 1: apk: not found
I just got an error and it didn't solve at all.
Meanwhile, I finally found an article that seems to be solved.
That is this article. A place stuck with Docker + django
In a Dockerfile like this article
Dockerfile
RUN pip install pillow
In "equirementes.txt",
equirementes.txt:equirementes.txt
Pillow==7.2.0
Enter.
Then type in the terminal as follows:
terminal
$ python manage.py makemigrations
$ python manage.py migrate
$ docker-compose up
That's it! I'd like to say, but I got an error when I opened the browser ...
OperationalError Despite the error, this solution was easy.
terminal
$ rm -d -r db.sqlite3
$ rm -d -r app/migrations/*
$ python manage.py migrate
This is OK!
Finally
terminal
$ docker-compose up
If you type in, it should be reflected beautifully.
By the way, here is the article I referred to.
django.db.utils.OperationalError: no such column: app_action.author_id error when opening web page ](https://teratail.com/questions/87239)
This time I wrote about the error I experienced. I will post an article about Djnago in the future, so I hope it will be helpful.
Recommended Posts