Learning Linux Basics Course & Labs : Troubleshoot the Development Environment

Task 8

It appears that Bob did not configure his app to connect a postgres database running on a different server.
That explains why things are working in his laptop and not in the DEV servers.
It also appears that he is using the wrong port for postgres!

Find the file in the directory under /opt/caleston-code that has a string matching DATABASES = { .
Replace the value of localhost to devdb01In the same file fix the postgres port to match the port being used on devdb01

I have tried every port available on the system but none of the additions worked.

I have checked a previous mention of the above issues and no solution was provided.

KIndly respond as soon as you can.

Thanks .

Hi @hedobriggs

In a previous task, we determine that the posgres port is 5432, so this will be the “right” port for it. Note that this is the default for postgres unless explicitly changed in the service configuration.

To the subtasks of task 8:

First of all note

That explains why things are working on his laptop and not in the DEV servers.

This means we need to fix it on the DEV server, devapp01. If you are running the commands from bob@caleston-lp10:~$ then that is “bob’s laptop” so ssh to devapp01 first

  1. I assume you found the correct file settings.py. In that file…
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'mercurydb',
            'USER': 'postgres',
            'PASSWORD': 'postgres',
            'HOST': 'localhost',
            'PORT': '5433',
        }
    }
    
  2. You need to change the value of HOST to devdb01
  3. …and PORT to 5432

image

Thanks for this clarity. The mistake was I was on the DB server instead of the App derver .

Issue resolved.