GeoDjango 入门问题
一旦我添加“from django.contrib.gis.db import models”而不是“from django.db import models”,Django就会停止识别该应用程序并给出此错误:
Error: App with label location could not be found. Are you sure your INSTALLED_APPS setting is correct?
一旦我注释掉“from”,该错误就会消失django.contrib.gis.db 导入模型”...
我已将“django.contrib.gis”和“位置”应用程序正确添加到 INSTALLED_APPS 设置中。
有任何线索为什么会发生这种情况吗?我正在我的 Windows 笔记本电脑上使用 Django v1.1.1 Final 运行。
As soon as I add "from django.contrib.gis.db import models" instead of "from django.db import models", Django stops recognizing the app and gives this error:
Error: App with label location could not be found. Are you sure your INSTALLED_APPS setting is correct?
The error goes away as soon as I comment out "from django.contrib.gis.db import models"...
I have added "django.contrib.gis" and the "location" app to the INSTALLED_APPS setting correctly.
Any clues why this is happening? I am running using Django v1.1.1 final, on my windows laptop.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的 INSTALLED_APPS 上有位置信息并收到此错误,则很可能您的 PYTHONPATH 中没有位置应用程序。
If you have location on your INSTALLED_APPS and are getting this error, most likely you don't have the location app in your PYTHONPATH.
使用 Synaptic 包管理器在 Ubuntu 10 上安装 Django 后,我遇到了同样的问题...
结果发现它没有安装所需的包“libgdal1”。手动选择它,GeoDjango 现在工作正常。
I was having the same problem after installing Django on Ubuntu 10 using Synaptic Package manager...
Turns out it didn't install the required package "libgdal1". Manually selected it and GeoDjango works fine now.
我使用 Postgres 8.4 遇到了同样的问题
GeoDjango 安装说明页面上给出的
psycopg2
和GeoDjango
链接依赖于 Postgres 8.3,所以,如果您使用Postgres 8.4,您必须从此处以及GeoDjango安装程序安装适当版本的psycopg2修改系统 Path 环境变量以包含
C:\Program Files\PostgreSQL\8.3\bin
。对于 Postgres 8.4,您必须将 Path 变量更改为 C:\Program Files\PostgreSQL\8.4\bin。
执行这些修改后,一切都必须正常工作:)
I had encountered the same issue using Postgres 8.4
Links to
psycopg2
andGeoDjango
given on GeoDjango installation instructions page rely on Postgres 8.3,So, if you use Postgres 8.4 you must install appropriate version of psycopg2 from here also GeoDjango installer modifies the system Path environment variable to include
C:\Program Files\PostgreSQL\8.3\bin
.In case of Postgres 8.4 you must change Path variable to
C:\Program Files\PostgreSQL\8.4\bin
.After performing these modifications all must work fine :)