Django Postgres Heroku - RichardForshaw/dev-tools-blog GitHub Wiki

Configuring your VM to do Django-Postgres-Heroku development

Get latest packages

Run sudo apt-get update to get the latest package indexes

Install latest python

Ubuntu 14 comes with Python 2.7.6. If you want the latest one, you will need to build it yourself:

wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
tar xzf Python-2.7.12.tgz
cd Python-2.7.12.tgz
./configure
make install

Upgrade to latest PostGres if required

Stop current postgres instance:

sudo /etc/init.d/postgresql stop

Get the latest. To do this you will need to add a PostGres repo to the apt sourceslist. These instructions are for Ubuntu14:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

To upgrade freom the old running version, do the following:

sudo /etc/init.d/postgresql stop
sudo pg_dropcluster --stop <oldversionnum> main
sudo /etc/init.d/postgresql start

Check which clusters are running with sudo pg_lsclusters

You might need to edit the /etc/postgresql/<newversion>/main/postgresql.conf file to change the port to 5432, otherwise django won't connect to it.

⚠️ **GitHub.com Fallback** ⚠️