开发者

Psycopg2 not linked correctly, wrong includes or something?

开发者 https://www.devze.com 2023-04-02 13:08 出处:网络
I\'m having trouble in getting Django work with a postgresl database on my webhosting provider. My situ开发者_运维技巧ation is as follows: I have an account on my webhosting provider, I do not have r

I'm having trouble in getting Django work with a postgresl database on my webhosting provider.

My situ开发者_运维技巧ation is as follows: I have an account on my webhosting provider, I do not have root-priviledges or the ability to install anything except locally in my home folder. I'm running Django through fcgi (because that is the only way for me afaik). I'm trying to convert my website to use Django. The webhosting server is running 64bit (debian or something custom I think).

After a LOT of trouble with includes (and especially where to put all the includes) I've gotten pretty far and Django stuff is mainly working, except making a connection to my postgresql database. I have "installed" (ie. untarred and put in my $PYTHONPATH) Django and psycopg2 to my ~/python-modules/ folder.

But for some reason I'm getting this when trying to do python manage.py syncdb:

> Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/home/users/username/python-modules/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/users/username/python-modules/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/users/username/python-modules/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/users/username/python-modules/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/home/users/username/python-modules/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/users/username/python-modules/django/core/management/commands/syncdb.py", line 7, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/home/users/username/python-modules/django/core/management/sql.py", line 6, in <module>
    from django.db import models
  File "/home/users/username/python-modules/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/home/users/username/python-modules/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/home/users/username/python-modules/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/home/users/username/python-modules/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/users/username/python-modules/django/db/backends/postgresql_psycopg2/base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: /home/users/username/python-modules/psycopg2-2.4.2/build/lib.linux-x86_64-2.6/psycopg2/_psycopg.so: undefined symbol: PyByteArray_Type

I currently have no idea why it can't find a basic python datatype. Psycopg2 linked to wrong python version or something?


yes, it looks like a versioning problem. more exactly the python running is lower than the one psycopg2 is built for (2.6)

you can check the python version by running 'python -V' or calling 'sys.version_info', but if your distribution is a debian stable then the default python is 2.5

0

精彩评论

暂无评论...
验证码 换一张
取 消