Skip to main content

Posts

Showing posts from March, 2016

How to setup PostgreSQL on Linux for Django

First step is to install PostgreSQL on Ubuntu. In its default installation, Ubuntu does not included PostgreSQL. So uou have to install it separately.
sudo apt-get install postgresql Now install the python module for accessing PostgreSQL -- psycopg2. You have two choices here -- either install this from the OS package manager or manually using pip. Which approach to choose depends on your python development environment.

i. If you're using the system python as development environment, you may install psycopg2 from the OS package manager. You can do this by
$ sudo apt-get install python-psycopg2
ii. However, if your python development environment is based on a virtual environment, the above approach will not work. This is because the above installs psycopg2 on the system python dist-packages, which does not copied into the virtual environment when it's created. This is the behavior even if the package is installed before the virtual environment is created. So in this case you nee…