rechie
rechie

Reputation: 2209

Django 1.4 + Apache WebServer + Mysql and PostgreSQL Connection Error

I have successfully followed the Django 1.4 Tutorial 1-4 (the poll system) and now its running until I deploy it in Apache Webserver 2.2 using Postgres Database. Everytime I access localhost I always have "Internal Server Error" but if I use MySQL as my database everything is ok. What do you think is wrong? Did I miss something to configure in Postgre?

Here is my database connection settings in Mysql(Working) and in Postgre(Not Working), both using Apache2.2 + mod_wsgi.so

//Postgre
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'django_demo1',                     
        'USER': 'postgres',
        'PASSWORD': 'mypassword', 
        'HOST': 'localhost',
        'PORT': '',       
    }
}

//MySQL
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'django_demo1',                     
        'USER': 'root',
        'PASSWORD': 'mypassword', 
        'HOST': 'localhost',
        'PORT': '',       
    }
}

Other INFO:

OS: windows 7, Python: 2.7, Django: 1.4, Postgre 9.1

Upvotes: 0

Views: 542

Answers (1)

Babu
Babu

Reputation: 2598

If you are able to access MySQL but not Postgres, I guess psycopg2 which is the Postgres adapter for python is not installed. Install psycopg2 using pip.

pip install psycopg2

Here is the pypi.

Upvotes: 1

Related Questions