gpt4 book ai didi

python - django.core.exceptions.ImproperlyConfigured : Could not find the GDAL library

转载 作者:太空宇宙 更新时间:2023-11-03 11:39:51 31 4
gpt4 key购买 nike

我正在尝试在 docker 中使用 gis:

这是django的Dockerfile:

FROM python:3.6-alpine

ENV PYTHONUNBUFFERED 1

RUN apk update \
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
# CFFI dependencies
&& apk add libffi-dev py-cffi \
# Translations dependencies
&& apk add gettext \
# https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
&& apk add postgresql-client


# ADD PostGIS here
# POSTGIS dependencies
ENV POSTGIS_VERSION 2.4.4
ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67


RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm postgis.tar.gz \
\
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
g++ \
json-c-dev \
libtool \
libxml2-dev \
make \
perl \
\
# add libcrypto from (edge:main) for gdal-2.3.0
&& apk add --no-cache --virtual .crypto-rundeps \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
libressl2.7-libcrypto \
&& apk add --no-cache --virtual .build-deps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
gdal-dev \
geos-dev \
proj4-dev \
protobuf-c-dev \
&& cd /usr/src/postgis \
&& ./autogen.sh \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure \
# --with-gui \
&& make \
&& make install \
&& apk add --no-cache --virtual .postgis-rundeps \
json-c \
&& apk add --no-cache --virtual .postgis-rundeps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
geos \
gdal \
py-gdal \
proj4 \
protobuf-c \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps .build-deps-testing
# && apk del .fetch-deps .build-deps .build-deps-testing
# END POSTGIS Changes


# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt

COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r//' /entrypoint
RUN chmod +x /entrypoint

COPY ./compose/local/django/start /start
RUN sed -i 's/\r//' /start
RUN chmod +x /start

COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker

COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r//' /start-celerybeat
RUN chmod +x /start-celerybeat

COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r//' /start-flower
RUN chmod +x /start-flower

WORKDIR /app

ENTRYPOINT ["/entrypoint"]

这是我的 postgres 的 Dockerfile:

FROM mdillon/postgis 

COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
&& rmdir /usr/local/bin/maintenance

我做错了什么?

最佳答案

只需删除Dockerfile这一行:&& apk del .fetch-deps .build-deps .build-deps-testing

我还没有弄清楚,但很可能它删除了我上面添加的所有包。

关于python - django.core.exceptions.ImproperlyConfigured : Could not find the GDAL library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51808969/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com