2017-09-18 43 views
0

我可以makemigrations,但不能migrate架構。無法遷移架構django-geoposition

Django的geoposition == 0.3.0
Django的== 1.11.5
python3.6.2
的PostgreSQL 9.6.5在x86_64-蘋果darwin14.5.0,蘋果LLVM版本7.0.0編譯(鐺-700.1.76),64位

import environ 
env = environ.Env() 

... 
DATABASES = { 
    'default': env.db("DATABASE_URL", default="postgres://postgres:[email protected]lhost:5432/soken_web") 
} 
DATABASES['default']['ATOMIC_REQUESTS'] = True 
DATABASES['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis' 
GEOPOSITION_GOOGLE_MAPS_API_KEY = '<API_KEY>' 
GEOPOSITION_MAP_OPTIONS = { 
    'minZoom': 3, 
    'maxZoom': 15, 
} 

GEOPOSITION_MARKER_OPTIONS = { 
    'cursor': 'move' 
} 


INSTALLED_APPS = [ 
    ... 
    'geoposition', 
] 
from django.contrib.gis.db import models 
from geoposition.fields import GeopositionField 


class House(models.Model): 
    ... 
    location = GeopositionField() 

問題:

django.db.utils.ProgrammingError: data type character varying has no default operator class for access method "gist" 
HINT: You must specify an operator class for the index or define a default operator class for the data type. 

個參考文獻:
Django django-location-field missing API Keys
https://github.com/caioariede/django-location-field

回答

1

如果你正在使用你可能需要的Postgres如在文檔說要安裝要點模塊:

https://www.postgresql.org/docs/9.2/static/btree-gist.html

可以使用btree_gist擴展在純標量數據類型上定義排除約束條件 ,然後可將其與範圍 排除在外最大的靈活性。例如,在安裝 後btree_gist,下面的約束將拒絕重疊範圍 僅在會議室數量相等:

+0

所以讓我4分鐘後接受。請稍候。非常感謝你。 – Sarit