When the database connectivity between Django and database pgsql9.1 is performed on Contos, the problem record

Source: Internet
Author: User

After you've installed Django and deployed the project, configure the setting.py file,

To modify database data:

Save the configuration, return to the project root, run the Python manage.py shell, and execute the following command:

>>> from django.db import connection

>>> cursor = Connection.cursor ()

When this method is validated, an error

File "<frozen importlib._bootstrap>", line 2254, in _gcd_import

File "<frozen importlib._bootstrap>", line 2237, in _find_and_load

File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line +, in _load_unlocked

File "<frozen importlib._bootstrap>", line 1129, in _exec

File "<frozen importlib._bootstrap>", line 1471, in Exec_module

File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed

File "/opt/python3.4.1/lib/python3.4/site-packages/django-1.7.1-py3.4.egg/django/db/backends/postgresql_ psycopg2/base.py ", line +, in <module>

Raise Improperlyconfigured ("Error loading PSYCOPG2 module:%s"% e)

Django.core.exceptions.ImproperlyConfigured:Error loading PSYCOPG2 module:libpq.so.5:cannot Open Shared Object file:n o Such file or directory

To use the workaround:

To download the Libpq.so.5 installation package:

wget ftp://ftp.muug.mb.ca/mirror/centos/5.11/os/x86_64/CentOS/postgresql84-libs-8.4.20-1.el5_10.i386.rpm


Then install:

RPM-IVH postgresql84-libs-8.4.20-1.el5_10.i386.rpm

The problem is resolved because the database version is 91, but the patch is supported for 84 of the database version and may have compatibility issues.


Problem logging when pgsql9.1 database connectivity for Django and database on Contos

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.