2011-12-02 102 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,似乎工作良好,但只有警告。

相關問題