我正在尝试按照this simple tutorial在我的网页上的传单上显示标记。但是,我收到以下错误:
来自django.contrib.gis.geos.geometry import Polygon ImportError: 无法导入名称多边形
由于from djgeojson.views import GeoJSONLayerView
urls.py
而导致
我不知道如何解决这个问题,我已经为geodjango安装了所有必需的依赖项,但找不到名为'Polygon'的包。
这是完整的错误:
Unhandled exception in thread started by <function wrapper at 0x7fbe7c083050>
Traceback (most recent call last):
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/mohamed/Dropbox/newsparse/newsparser/src/newsparser/urls.py", line 22, in <module>
url(r'^', include('textnews.urls')),
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/mohamed/Dropbox/newsparse/newsparser/src/textnews/urls.py", line 19, in <module>
from djgeojson.views import GeoJSONLayerView
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/djgeojson/views.py", line 6, in <module>
from django.contrib.gis.geos.geometry import Polygon
ImportError: cannot import name Polygon