Answer the question
In order to leave comments, you need to log in
How to fix errors like "Unable to import 'django.http'"?
Raised python and django through docker to go through django tutorial. Tutorial passed, everything is fine. Only here a bunch of type "errors" (pylint swears) fell into the terminal. It looks ugly, all files are red because of underlines from pylint.
Why is pylint swearing? How to get rid of pseudo "errors"?
Dockerfile
FROM python:3.8-alpine
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
RUN mkdir /myproject
WORKDIR /myproject
COPY ./myproject /myproject
RUN adduser -D user
USER user
version: "3"
services:
web:
build:
context: .
dockerfile: ./Dockerfile
ports:
- "8000:8000"
volumes:
- ./myproject:/myproject
command: python manage.py runserver 0.0.0.0:8000
Django>=2.2.7,<2.3.0
djangorestframework>=3.10.3,<3.11.0
Answer the question
In order to leave comments, you need to log in
WORKDIR /myproject
creates the directory itself, mkdir
you do not need to call it first.
Linter, in this situation, also needs to be run in a container.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question