psycopg2.OperationalError: FATAL: password authentication failed for user "nouman"
You need to create DB user with command
CREATE ROLE username WITH LOGIN PASSWORD 'quoted password';CREATE DATABASE databasename;GRANT ALL PRIVILEGES ON DATABASE databasename TO username;
read here
A default PostgresSQL installation always includes the postgres superuser. Initially, you must connect to PostgreSQL as the postgres user until you create other users (which are also referred to as roles).
To create a PostgreSQL user, follow these steps:
At the command line, type the following command as the server's rootuser:
su - postgres
You can now run commands as the PostgreSQLsuperuser. To create a user, type the following command:
createuser --interactive --pwprompt
Follow the instructions on command line. PostgreSQL creates the user with the settings you specified.