Getting 'DatabaseOperations' object has no attribute 'geo_db_type' error when doing a syncdb

前端 未结 9 1946
有刺的猬
有刺的猬 2020-12-01 08:43

I\'m attempting to run heroku run python manage.py syncdb on my GeoDjango app on Heroku, but I get the following error:

AttributeError: \'Databa

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 09:25

    The OP was using the GeoDjango buildpack, but in case anyone gets here using Geo buildpack and dj_database_url like I was, in settings.py don't forget the last line:

    import dj_database_url
    DATABASES['default'] = dj_database_url.config()
    DATABASES['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis'
    

    UPDATE

    dj_database_url directly supports PostGIS. You can do without the last line in the code above if you can change your database URL to start with postgis.

提交回复
热议问题