在Django中为ubuntu11.10设置postgresql9.1数据库

2024-10-01 17:25:08 发布

您现在位置:Python中文网/ 问答频道 /正文


我试图在django1.3中配置postgresql9.1。
注意:我是在Ubuntu11.10(oneric)中完成的。另外,我还安装了postgis 1.5,以便与Postgresql 9.1一起使用

据我所知,我已经安装了所需的所有依赖项。
我也读了this博客上的说明。在

在执行以下操作时:

python manage.py syncdb

我得到了这个错误堆栈。在

^{pr2}$

在本地_设置.py,我已将引擎名称设置为'django.db.后端.postgresql_psycopg2'。在

但是,在引用this之后,我将引擎名称设置为'django.contrib.gis公司.后台数据库.postgis'时,我得到以下错误堆栈:

    Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/south/management/commands/__init__.py", line 10, in <module>
    import django.template.loaders.app_directories
  File "/usr/local/lib/python2.7/dist-packages/django/template/loaders/app_directories.py", line 21, in <module>
    mod = import_module(app)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/jigish/jigbox/dev/mangrove/datawinners/datawinners/../datawinners/accountmanagement/__init__.py", line 3, in <module>
    from datawinners.accountmanagement.post_registration_events import ngo_user_created
  File "/home/jigish/jigbox/dev/mangrove/datawinners/datawinners/../datawinners/accountmanagement/post_registration_events.py", line 3, in <module>
    from datawinners.accountmanagement.models import NGOUserProfile
  File "/home/jigish/jigbox/dev/mangrove/datawinners/datawinners/../datawinners/accountmanagement/models.py", line 5, in <module>
    from django.db import models
  File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 51, in load_backend
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django.contrib.gis.db.backends.postgis' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named postgresql.operations

我甚至确保安装了postgis(Postgresql-9.1-postgis)。在

我哪里出错了?我错过了什么? 这是我早期使用Python、Django、Postgresql和Postgis的时候。
请指出网页上任何相关的有用链接。我试着用谷歌搜索,但到目前为止没有成功。

谢谢和问候


Tags: djangoinpyimportdbinitlibpackages

热门问题