当我使用 docker-compose 运行图像时出现错误这是我的 pipfile 与库 rq 我尝试升级图像但在 django-rq 中出现错误,但我没有更改这个库我只添加到我的 docker 文件中用于安装库 pyodbc 的命令 unixodbc-dev 现在无法使用另一个库
[packages]
django = "~=2.2.2"
djangorestframework = "~=3.9.4"
djangorestframework-jwt = "~=1.11.0"
django-simple-history = "~=2.7.2"
django-cors-headers = "~=2.5.3"
django-pandas = "~=0.6.1"
django-rq = "~=2.1.0"
django-import-export = "~=1.2.0"
django-filter = "~=2.1.0"
#reemplazar cuando saquen nueva versión estable (1.0)
djangorestframework-filters = "==1.0.0.dev0"
drf-yasg = "~=1.15.0"
"drf-yasg[validation]" = "~=1.15.0"
django-enumfield = "~=1.5"
django-postgres-extra = "==1.21a17"
psycopg2-binary = "~=2.8.2"
requests = "~=2.22.0"
pyarrow = "~=0.13.0"
sqlalchemy = "~=1.3.4"
pandas = "~=0.24.2"
xlrd = "~=1.2.0"
python-jose = "~=3.0.1"
Pillow = "~=6.0.0"
django-post_office = "~=3.2.0"
django-crontab = "~=0.7.1"
flatbuffers = "~=1.10"
fs = "~=2.4.5"
python-json-logger = "~=0.1.10"
django-debug-toolbar = "~=1.11"
cryptography = "~=2.5"
more-itertools = "~=7.0.0"
whitenoise= "~=4.1.2"
django-email-bandit = "~=1.5"
python-pptx = "~=0.6.18"
django-storages = "~=1.7.1"
"django-storages[azure]" = "~=1.7.1"
"django-redis" = "~=4.10.0"
"django-rest-framework-condition" = "~=0.1.1"
"django-grappelli" = "~=2.12.2"
mypy_extensions = "~=0.4.1"
python-dotenv = "~=0.10.1"
pymssql = "~=2.1.4"
xhtml2pdf = "~=0.2.3"
azure = "~=4.0.0"
adal = "~=1.2.2"
pyodbc = "~=4.0.30"
[dev-packages]
psutil = "~=5.5.1"
mimesis = "~=3.1.0"
pytest = "~=4.3.0"
pytest-django = "~=3.4.8"
pylint = "*"#linter
pylint-django = "*"
autopep8 = "*"
notebook = "*"
rope = "*"
v = {editable = true,version = "*"}
mypy = "*"
[requires]
python_version = "3.7"
[pipenv]
allow_prereleases = true
但是当我在本地进行 docker-compose 时出现此错误,我的 python 版本是 3.7.4,这是我的 dockerfile 配置
FROM python:3.7.2 AS base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client cron unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /srv/server
COPY ./server/Pipfile ./
COPY ./server/Pipfile.lock ./
RUN pip install pipenv uwsgi && pipenv install --deploy --system
ENV PYTHONPATH=/srv/
ENV PYTHONUNBUFFERED=1
ENV UWSGI_THREADS=3
ENV UWSGI_PROCESSES=4
ENV UWSGI_OFFLOAD_THREADS=1
ENV UWSGI_MODULE=server.wsgi:application
ENTRYPOINT [ "sh", "./scripts/wait-for-postgres.sh", "pgrouting", "bash", "./scripts/init.sh" ]
FROM base as test
RUN pipenv install --deploy --system --dev
COPY ./server/ /srv/server/
COPY ./commonlib/ /srv/commonlib/
RUN pytest --junitxml=/srv/test_results/test-results.xml
FROM base as prod
ARG TAG
COPY --from=test /srv/test_results/test-results.xml /srv/test_results/test-results-${TAG}.xml
COPY --from=test /srv/server/ /srv/server/
COPY --from=test /srv/commonlib/ /srv/commonlib/
gateway_1 | Traceback (most recent call last):
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 66, in __getitem__
gateway_1 | return self._engines[alias]
gateway_1 | KeyError: 'django'
gateway_1 |
gateway_1 | During handling of the above exception, another exception occurred:
gateway_1 |
gateway_1 | Traceback (most recent call last):
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries
gateway_1 | module = import_module(entry[1])
gateway_1 | File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
gateway_1 | return _bootstrap._gcd_import(name[level:], package, level)
gateway_1 | File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
gateway_1 | File "<frozen importlib._bootstrap>", line 983, in _find_and_load
gateway_1 | File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
gateway_1 | File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
gateway_1 | File "<frozen importlib._bootstrap_external>", line 728, in exec_module
gateway_1 | File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django_rq/templatetags/django_rq.py", line 4, in <module>
gateway_1 | from rq.exceptions import UnpickleError
gateway_1 | ImportError: cannot import name 'UnpickleError' from 'rq.exceptions' (/usr/local/lib/python3.7/site-packages/rq/exceptions.py)
gateway_1 |
gateway_1 | During handling of the above exception, another exception occurred:
gateway_1 |
gateway_1 | Traceback (most recent call last):
gateway_1 | File "/srv/server/manage.py", line 21, in <module>
gateway_1 | execute_from_command_line(sys.argv)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
gateway_1 | utility.execute()
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
gateway_1 | self.fetch_command(subcommand).run_from_argv(self.argv)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
gateway_1 | self.execute(*args, **cmd_options)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 361, in execute
gateway_1 | self.check()
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
gateway_1 | include_deployment_checks=include_deployment_checks,
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 65, in _run_checks
gateway_1 | issues.extend(super()._run_checks(**kwargs))
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
gateway_1 | return checks.run_checks(**kwargs)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
gateway_1 | new_errors = check(app_configs=app_configs)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 79, in check_dependencies
gateway_1 | for engine in engines.all():
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in all
gateway_1 | return [self[alias] for alias in self]
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 90, in <listcomp>
gateway_1 | return [self[alias] for alias in self]
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/utils.py", line 81, in __getitem__
gateway_1 | engine = engine_cls(params)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 25, in __init__
gateway_1 | options['libraries'] = self.get_templatetag_libraries(libraries)
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries
gateway_1 | libraries = get_installed_libraries()
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries
gateway_1 | for name in get_package_libraries(pkg):
gateway_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 125, in get_package_libraries
gateway_1 | "trying to load '%s': %s" % (entry[1], e)
gateway_1 | django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django_rq.templatetags.django_rq': cannot import name 'UnpickleError' from 'rq.exceptions' (/usr/local/lib/python3.7/site-packages/rq/exceptions.py)