@trickster2019

Как исправить ошибку «web_1 | ModuleNotFoundError: No module named 'corsheaderscorsheaders»?

пытаюсь запустить docker с DJANGO REST, но столкнулся с ошибкой "web_1 | ModuleNotFoundError: No module named 'corsheaderscorsheaders"
содержимое Dockerfile
# syntax=docker/dockerfile:1
FROM python:3
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

содержимое requirements.txt
Django==4.1
djangorestframework==3.13.1
markdown==3.4.1
django-filter==22.1
django-cors-headers==3.13.0

"corsheaders" добавлен в INSTALLED_APPS
команда "docker-compose build" выполняется без проблем
но когда пытаюсь выполнить "docker-compose up" вылетает ошибка
Recreating django_coffee_house_web_1 ... done
Attaching to django_coffee_house_web_1
web_1  | Watching for file changes with StatReloader
web_1  | Exception in thread django-main-thread:
web_1  | Traceback (most recent call last):
web_1  |   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
web_1  |     self.run()
web_1  |   File "/usr/local/lib/python3.10/threading.py", line 953, in run
web_1  |     self._target(*self._args, **self._kwargs)
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
web_1  |     fn(*args, **kwargs)
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
web_1  |     autoreload.raise_last_exception()
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
web_1  |     raise _exception[1]
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 398, in execute
web_1  |     autoreload.check_errors(django.setup)()
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
web_1  |     fn(*args, **kwargs)
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
web_1  |     apps.populate(settings.INSTALLED_APPS)
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
web_1  |     app_config = AppConfig.create(entry)
web_1  |   File "/usr/local/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
web_1  |     import_module(entry)
web_1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
web_1  |     return _bootstrap._gcd_import(name[level:], package, level)
web_1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
web_1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
web_1  |   File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
web_1  | ModuleNotFoundError: No module named 'corsheaderscorsheaders'
  • Вопрос задан
  • 40 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы