Switching To PostgreSQL For Your Django Project

development

The default database option for Django is SQLite, which is a great option to get up and running quickly but it may not scale well beyond a certain point. A good alternative is PostgreSQL and, although it's overkill for my purposes, it's what I'm using for this website.

Follow the steps below to start using PostgreSQL for your Django project. If you are working with an existing project you will need to backup the data in your current database beforehand and restore it in PostgreSQL afterwards.

Install Required Packages

Open the terminal and run the commands below to install the necessary packages.

libpq allows client programs to communicate with a PostgreSQL database.

sudo apt-get install libpq-dev

python3-dev is required to build psy...

Read more

Refactoring Microsoft Access Databases With Python

development

Working with an inherited legacy application can feel like an insurmountable task. I found myself in this position at work where there is a sizable amount of code in legacy Microsoft Access databases. Access in particular can be difficult to work with as it doesn't make implementing software development best practices easy. In the wrong hands an Access database can quickly turn into a mess.

The way I've approached refactoring Access database is to first export all of the database objects (tables, queries, forms, reports, macros, and modules) to text files. I then use Python to search the exported files for object references. This makes the task of determining which objects can be safely removed or changed much more manageable.

Exporting ...

Read more

Keep Sensitive Data Out Of Source Control

development

Using source control tools, such as Git or Mercurial, is a good idea for projects of any size; however, some developers using these tools may overlook the importance of hiding sensitive information from their repository. This is especially important if the repository is public.

I recently had to take this into consideration when starting this website so I spent some time exploring my options. There are a few Django settings that I knew should be hidden: the project's secret key and the database connection information.

Two solutions are to use a settings file that is not tracked in source control or to use environment variables. There are possibly better solutions but these are two good options. I decided to use a settings file but I'll o...

Read more

Getting Started With Django

development

I've been wanting to get more familiar with web development and since I'm a fan of Python I chose to start with the Django framework. I've been very pleased with the framework and it's been fun to learn. Below are some of the resources that have helped me starting out.

I began by going through a few tutorials. These provided a good introduction to some of the various aspects of developing a website with Django.

After completing each tutorial I decided to make a personal website with a blog and portfolio. This is currently still a work in progress but it was a simple enough project to start with.

I also decided to take on the task of deploying the project myself to a VPS. I chose to deploy to Dig...

Read more