【发布时间】:2022-01-12 18:01:32
【问题描述】:
运行docker-compose run server python manage.py makemigrations(进行迁移)并收到此错误时:
django.template.library.InvalidTemplateLibrary: Invalid template library specified.
ImportError raised when trying to load 'rest_framework.templatetags.rest_framework': No mo
dule named 'pytz'
我的docker-compose.yml:
version: '3'
services:
db:
build: ./etc/docker/db
restart: always
volumes:
- ./var/volumes/dbdata:/var/lib/mysql
env_file:
- ./etc/docker/db/env
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=example
interval: 1s
timeout: 5s
retries: 10
server: &web
build:
context: .
dockerfile: ./etc/docker/web/Dockerfile
volumes:
- ./server:/home/web/server
# depends_on:
# db: {condition: service_healthy}
ports:
- "8080:8080"
command: ["python", "manage.py", "runserver", "0.0.0.0:8080"]
我尝试通过 pip install pytz 安装pytz,但我仍然遇到同样的错误。现在我很困惑,请解释问题可能是什么。
【问题讨论】:
-
pip install pytz? -
@KlausD。更新了问题;)我试过了,但仍然得到同样的错误
-
我想,我有两种不同的 Python:来自 Windows 和来自 WSL。 Docker用的是第二种,但是我不知道怎么访问一个
标签: python django docker rest pip