Django GDAL and CircleCI 2


#1

I have a Django app configured with GeoDjango that is failing on every build with the following error:

django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library. Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.

However, when I remove 'django.contrib.gis' from DJANGO_APPS in settings.py the build runs successfully.

Are there additional steps for configuring GDAL in CircleCI 2.0 outside of the postgres docker image? Below is my 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

    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

#2

I tried, adding the geodata/gdal image or similar, from DockerHub, without luck.
Nor with setting GDAL_LIBRARY_PATH or GDAL_VERSION :confused:

I went with Travis and it worked pretty well there. I wish I went for CircleCI.


#3

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.