首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Heroku CI上安装Postgis

无法在Heroku CI上安装Postgis
EN

Stack Overflow用户
提问于 2021-07-07 19:28:18
回答 1查看 67关注 0票数 1

在Heroku中部署我的应用程序进行测试时,我遇到以下错误:

代码语言:javascript
复制
self = <django.db.backends.utils.CursorWrapper object at 0x7f634cc50a00>
sql = 'CREATE EXTENSION IF NOT EXISTS postgis', params = None
ignored_wrapper_args = (False, {'connection': <django.contrib.gis.db.backends.postgis.base.DatabaseWrapper object at 0x7f635095d2b0>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f634cc50a00>})
    def _execute(self, sql, params, *ignored_wrapper_args):
        self.db.validate_no_broken_transaction()
        with self.db.wrap_database_errors:
            if params is None:
                # params default might be backend specific.
>               return self.cursor.execute(sql)
E               django.db.utils.OperationalError: could not open extension control file "/app/.indyno/vendor/postgresql/share/extension/postgis.control": No such file or directory
.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py:82: OperationalError

我的app.json文件中有以下代码:

代码语言:javascript
复制
{
  "buildpacks": [
    {
      "url": "https://github.com/heroku/heroku-geo-buildpack.git"
    },
    {
      "url": "heroku/python"
    }
  ],
  "environments": {
    "test": {
      "addons": [
        "heroku-postgresql:in-dyno"
      ],
      "scripts": {
        "test": "pytest"
      }
    }
  }
}

从我得出的结论中,我看到错误发生在执行SQL命令'CREATE EXTENSION IF NOT EXISTS postgis'时。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-08 10:07:23

在深入搜索解决方案之后,我添加了以下构建包:https://github.com/riskmethods/heroku-buildpack-ci-postgis

而这仍然引发了错误;psycopg2.errors.UndefinedFile: could not load library "/app/.indyno/vendor/postgresql/lib/postgis-2.5.so": /app/.indyno/vendor/postgresql/lib/postgis-2.5.so: undefined symbol: AllocSetContextCreateExtended。可以通过使用PostgreSQL版本11来解决。我将我的app.json文件更改为:

代码语言:javascript
复制
{

  "environments": {
    "test": {
      "buildpacks": [
        {
          "url": "https://github.com/heroku/heroku-geo-buildpack.git"
        },
        {
          "url": "heroku/python"
        },
        {
          "url": "https://github.com/riskmethods/heroku-buildpack-ci-postgis"
        }
      ],
      "env": {
        "POSTGRESQL_VERSION": "11"
      },
      "addons": [
        "heroku-postgresql:in-dyno"
      ],
      "scripts": {
        "test": "pytest"
      }
    }
  }
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68285147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档