English 中文(简体)
Unable to syncdb in GeoDjango App
原标题:Unable to syncdb in GeoDjango App

我在建立空间数据库并将其与GeoDjango混为一谈方面遇到实际困难。 我能够按照几andjango文件建立空间数据库,并制作一个连环灯,但一经运行。

<代码>python管理。 py sqlall world

我正在这样做,

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module( %s.management.commands.%s  % (app_name, name))
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/commands/sqlall.py", line 4, in <module>
    from django.core.management.sql import sql_all
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/sql.py", line 6, in <module>
    from django.db import models
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict[ ENGINE ])
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
    backend = load_backend(db[ ENGINE ])
  File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/db/utils.py", line 44, 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 psycopg2.extensions

我很疲 ,实际上不敢做什么? 请帮助

EDIT

Ok I found this link which kind of tells me what went wrong. Now when i get into the python from home, and i execute import psycopg2 it does not give me any ImportError but when i am inside the virtual env, I get the ImportError

(django-env)smaranh@ubuntu:~/geodjango$ python
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.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named psycopg2

现在,联系人指导我如何思考道路,但我并不真正理解这一进程,因为我是新鲜的,我不想再rew。 因此,有些人能够用插手来指导我如何修改<条码>sys.path?

最佳回答

If you are using virtualenv you need install psycopg2 inside the environment, something like:

pip install psycopg2 

但你需要安装一些包裹,然后才能:

sudo apt-get install python-dev postgresql-server-dev-all
问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签