0

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

5
  • 1
    Have you installed psycopg2 module? Commented Jul 27, 2012 at 10:14
  • 1
    what's the error message in the apache error log file? btw. enable DEBUG=True in your settings. Commented Jul 27, 2012 at 10:15
  • 1
    Check your webserver's logs if you need to know the details. We can just guess. Could be missing python dependencies for postgresql for example. Commented Jul 27, 2012 at 10:19
  • thank you guys. I have found psycopg2 is not found. that solves the problem. Commented Jul 27, 2012 at 10:23
  • I already did it! +1 for you! Commented Jul 27, 2012 at 10:27

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks babu! Yes, i just found out that psycopg2 is missing. After i installed, everything is ok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.