17👍
pipenv --rm
This helped me! I was starting the "Django for beginners" and at the very beginning, got this error (accidently deleted Pipfile & Pipfile.lock)
6👍
Your warning is saying you that there is no Pipfile
in your project dir.
–system is intended to be used for pre-existing Pipfile.
So before running
docker build .
run
pipenv install
in your project folder
- Convert data on AlterField django migration
- How can I schedule a Task to execute at a specific time using celery?
- Invalid data. Expected a dictionary, but got str error with serializer field in Django Rest Framework
- Celery – No module named five
- Django mysqlclient install
0👍
It has Error in pipenv
It is 👇
ERROR:: --system is intended to be used for pre-existing Pipfile installation, not installation of specific packages. Aborting.
try it
pipenv check
or python3 -m pipenv check
- Model self-dependency (one-to-many field) implementation
- What are the valid values for a django URL field?
- Django filter through multiple fields in a many-to-many intermediary table
- ImportError: cannot import name simplejson. I am using django v1.8 and django-Select2 v4.3.1
- Django: Password reset email subject line contains 'example.com
0👍
Be careful when using Docker bind mounts!
Summary: In my case, I was using bind mounts in my dev environment, and mounting a docker bind mount on a non-empty directory would overwrite the contents of the container’s directory, removing the Pipfile
and Pipfile.lock
, which showed the error mentioned when running the container.
Explanation
Directory structure on the host
> ls project/
docker-compose.yml Dockerfile Pipfile Pipfile.lock app/
Dockerfile
My Dockerfile
would copy the contents of the project and then install the dependencies with pipenv
, like this:
FROM python:3.8
# ...
COPY Pipfile Pipfile.lock /app/
RUN pipenv install --deploy --ignore-pipfile
COPY ./app /app/
CMD ["pipenv", "run", "uvicorn", "etc..", "--reload"]
Pipfile
, Pipfile.lock
and the code of ./app
would all be in the same /app
directory inside the container.
docker-compose.yml
I wanted uvicorn to hot-reload, so I mounted the code in /app
inside the container’s /app
directory.
service:
app:
#...
volumes:
- type: bind
source: ./app
target: /app
This meant that when I changed the code in /app
, the code in the container’s /app
directory would also change.
Effects
The side effect of this bind mount is that the content mounted on /app
"obscured" the content previously copied in there.
Container’s content with the bind mount:
> ls app/
code1.py code2.py
Container’s content without the bind mount:
> ls app/
Pipfile Pipfile.lock code1.py code2.py
Solution
Either make sure that you include the Pipfile
and Pipfile.lock
as well when mounting the bind mount, or make sure that you COPY
these 2 files to a directory that won’t get overwritten by a bind mount.
- How should I represent a bit flags int field in django admin?
- How to debug Django custom management command using VS Code