我有一个配置了GeoDjango的Django应用程序,在CircleCI 2.0构建中出现以下错误:
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library. Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
然而,当我在settings.py
中从DJANGO_APPS
中删除'django.contrib.gis'
时,构建成功运行。
除了使用postgres和GDAL docker镜像外,是否还有其他配置GDAL的步骤?我(可能错误地)假设在安装docker镜像后可以找到GDAL。以下是我的config.yml
:
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.3
- image: circleci/postgres:10.1-postgis
environment:
- POSTGRES_USER=ubuntu
- POSTGRES_DB=myapp_test
- image: geodata/gdal
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}
- run:
name: run tests
command: |
. venv/bin/activate
python manage.py test
environment:
DATABASE_URL: "postgres://ubuntu@localhost:5432/myapp_test"
- store_artifacts:
path: test-reports
destination: test-reports
sudo apt-get update && sudo apt-get install -y gdal-bin python-gdal python3-gdal
- Leila Hadj-Chikh