Install Java version 8

I ran into an issue while re-configuring the Jira installation on my system. After an update Java 8 was needed but it is not present by default on Ubuntu 14.04. To install the JRE and JDK you need to add the repository of the webupd8team and use the Oracle Java 8 installer.

Upgrade PostgreSQL

By default Ubuntu 14.04 is running PostgreSQL version 9.3. In order to use the json datatype PostgreSQL version 9.4 or bigger is needed. The versions can be installed side by side, but for clarity you could remove the

Write dictionary to CSV in Python

import csv

def write_dictionary_to_csv(o_file, d):
    """ Write dictionary to output file """
    with open(o_file, 'wb') as csvfile:
        outputwriter = csv.writer(csvfile, delimiter=';', quoting=csv.QUOTE_MINIMAL)
        outputwriter.writerow(d.keys())
        outputwriter.writerows(zip(*d.values()))

dictionary = {"key1": [12,23,34],
              "key2": [45,56,67],
              "key3": [78,89,90]}
output_file = 'output.csv'
write_dictionary_to_csv(output_file, dictionary)

Move Django database between servers

Save the database on the old server.

(oldenv)jitsejan@oldvps:/opt/oldenv/django_project$ sudo python manage.py dumpdata blog > blog.json

Load the data on the new server. Make sure the models for both blogs are identical.

(env)jitsejan@jjsvps:/opt/env/django_project$ sudo python manage.py loaddata blog.json