In settings.py in the source code that you linked , it seems that you have two conflicting declarations for setting DATABASES
1) line 3:
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
2) line 16:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'traineeworld', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } }
3) In addition, the extra code of your last edit looks like another way to specify connection arguments, which probably again negates the consequences of previous declarations.
These methods should not stack on top of each other. You want to choose only one.
In addition, technically, as the initiator of a client connection to the db server, you should know if the server must be reached via TCP (in this case, its hostname or IP address plus port), or through a Unix domain socket file, and in this case its full path to the directory (starting with a slash). In both cases, this is part of the HOST parameters.
Postgres provides default values โโfor all of them, but once you mix and match different pieces of software from different sources, these default values โโno longer help, and providing explicit values โโbecomes a requirement.
If you doubt the socket path, inside psql when connecting as a postgres user, this path can be obtained with the SQL command:
SHOW unix_socket_directory;
This parameter is also present in the server-side postgresql.conf configuration file.