在RHEL6上安装时Geodjango应用程序出错

时间:2014-11-05 09:30:52

标签: python django postgresql postgis rhel6

我正在尝试在RHEL 6.5计算机上安装geo-django应用程序。该应用程序在Ubuntu 12.04(python 2.7,django 1.4,mapnik,tilecache& postgis(9.1)启用postgresql 9.1)中运行良好。但是当我在RHEL 6.5中安装相同内容时,使用geodjango API的postgis查询无效。查询是

pt1 = MyModel.objects.filter(thegeom__dwithin=(the_geom, 250)).distance(the_geom).order_by('distance')

其中" the_geom"是另一个表的几何值。

执行此查询时,我收到错误

' NoneType'对象没有属性' group'

回溯错误是

Traceback (most recent call last):
  File "<console>", line 2, in <module>
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/query.py", line 100, in distance
    return self._distance_attribute('distance', geom, **kwargs)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/query.py", line 582, in _distance_attribute
    geodetic = geo_field.geodetic(connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 131, in geodetic
    return self.units_name(connection) in self.geodetic_units
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 122, in units_name
    self._get_srid_info(connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 108, in _get_srid_info
    self._units, self._units_name, self._spheroid = get_srid_info(self.srid, connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 35, in get_srid_info
    units, units_name = sr.units
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/backends/base.py", line 280, in units
    return (self.linear_units, self.linear_name)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/backends/base.py", line 252, in linear_units
    return m.group('unit')
    AttributeError: 'NoneType' object has no attribute 'group'

0 个答案:

没有答案