by Kai Wang, TA from last year

1. PostgreSQL setting

When you install the PostgreSQL in your VM, it will by default create a server in your localhost and also create a database named postgres and a user named postgres. After acknowledging that, you could configure the database by default in your settings.py as below form:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'postgres',
        'USER': 'postgres',
        'HOST': '',
        'PORT': 5432,
    }
}

The empty HOST field means your localhost. And you could add more database and user as well as changing database configuration. But please notice that it will only change your local database server.

2. Docker Settings and Debug

Professor Brian will elaborate more about container and Docker in class. This note will only explain why we add 'web' to ALLOWED_HOSTS, how to change the database settings while running the program inside docker and how to debug in docker.

2.1 Docker Compose

When you firstly use the command sudo docker-compose up, it will build the image and then run the service (docker container). Docker-compose is a tool for defining and running multi-container Docker applications.

And let's have a look of docker-compose for Assignment 1.

Take service web-init for example. Let us go through the service configuration line by line.

For more information please refer to Docker document and docker-compose document.