2011-12-02 100 views
1

我试图做一个应用程序与geoDjango但我实际上有一些问题,使其运行。 当我excecute的 “蟒蛇manage.py执行syncdb” 命令,我有以下错误:geoDjango - ImportError:无法导入名称SpatialBackend

File "/media/datos/Proyectos/CualBondi/git/cualbondi/myapp/models.py", line 10, in <module> 
from django.contrib.gis.db import models 
File "/usr/local/lib/python2.6/dist-packages/django/contrib/gis/db/models/__init__.py", line 5, in <module> 
from django.contrib.gis.db.models.aggregates import * 
File "/usr/local/lib/python2.6/dist-packages/django/contrib/gis/db/models/aggregates.py", line 2, in <module> 
from django.contrib.gis.db.models.sql import GeomField 
File "/usr/local/lib/python2.6/dist-packages/django/contrib/gis/db/models/sql/__init__.py", line 2, in <module> 
from django.contrib.gis.db.models.sql.query import GeoQuery 
File "/usr/local/lib/python2.6/dist-packages/django/contrib/gis/db/models/sql/query.py", line 4, in <module> 
from django.contrib.gis.db.models.fields import GeometryField 
File "/usr/local/lib/python2.6/dist-packages/django/contrib/gis/db/models/fields/__init__.py", line 3, in <module> 
from django.contrib.gis.db.backend import SpatialBackend, gqn 
ImportError: cannot import name SpatialBackend 

我这里给您一些额外的信息:

  • 的Django 1.3.1
  • Python 2.6
  • Ubuntu 10.04
  • PostgreSQL 8.4.8

你有什么想法吗? 非常感谢!

回答

0

也许这有帮助,SpatialBackend似乎不推荐使用。阅读下面的警告。

$ python manage.py shell 
Python 2.7.2+ (default, Oct 4 2011, 20:06:09) 
[GCC 4.6.1] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
(InteractiveConsole) 
>>> from django.contrib.gis.db.backend import SpatialBackend, gqn 
/usr/lib/pymodules/python2.7/django/contrib/gis/db/backend/__init__.py:5: UserWarning: The `django.contrib.gis.db.backend` module was refactored and renamed to `django.contrib.gis.db.backends` in 1.2. All functionality of `SpatialBackend` has been moved to the `ops` attribute of the spatial database backend. A `SpatialBackend` alias is provided here for backwards-compatibility, but will be removed in 1.3. 
    warn('The `django.contrib.gis.db.backend` module was refactored and ' 
Traceback (most recent call last): 
    File "<console>", line 1, in <module> 
ImportError: cannot import name gqn 

我在django 1.3.0,似乎工作良好,但只有警告。

相关问题