Django Tutorial · PostgreSQL

PostgreSQL Intro

Learn all about PostgreSQL Intro in this comprehensive tutorial.

5 min read advanced
  • Django comes with a SQLite database which is great for testing and debugging at the beginning of a project.
  • PostgreSQL database is an open source relational database, which should cover most demands you have when creating a database for a Django project.
  • Type this command in the command line to install the package.

Database Engines

Django comes with a SQLite database which is great for testing and debugging at the beginning of a project.

However, it is not very suitable for production.

Django also support these database engines:

  • PostgreSQL
  • MariaDB
  • MySQL
  • Oracle

We will take a closer look at the PostgreSQL database engine.

PostgreSQL

PostgreSQL database is an open source relational database, which should cover most demands you have when creating a database for a Django project.

It has a good reputation, it is reliable, and it perform well under most circumstances.

We will add a PostgreSQL database to our Django project.

To be able to use PostgreSQL in Django we have to install a package called psycopg2.

Install psycopg2

Type this command in the command line to install the package. Make sure you are still inn the virtual environment:

python

The result should be something like this:

python

The psycopg2 package is a driver that is necessary for PostgreSQL to work in Python.

We also need a server where we can host the database.

In this tutorial we have chosen the Amazon Web Services (AWS) platform, you will learn more about that in the next chapter.

Module quiz

2 questions
1

Which of the following is true about PostgreSQL Intro?

2

What is the most common pitfall when working with PostgreSQL Intro?

Answer all questions to submit.