Flask & Alchemy - (psycopg2.OperationalError) FATAL: password authentication failed : <p>I'm new to python. I have to develop a simple Flask app (in my local Ubuntu 16.4)  with PostgreSQL as database.</p>

<p>I install pgadmin, Flask, SQLAlchemy and postgres and also this is my app code:</p>

<pre><code>from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://dbUserName:userNamePassword@localhost/dbName'

db = SQLAlchemy(app)
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    email = db.Column(db.String(120), unique=True)

    def __init__(self, username, email):
        self.username = username
        self.email = email

    def __repr__(self):
        return '&lt;User %r&gt;' % self.username

@app.route('/')

def index():
    return "Hello Flask"


if __name__ == "__main__":
    app.run()
</code></pre>

<p>Also I create a database and new user in pgAdmin (and replace them with related variable in my code), but when I try to test this code in python shell I found error.</p>

<p>my python code:</p>

<pre><code>from app import db
</code></pre>

<p>result:</p>

<pre><code>/home/user/point2map2/venv/lib/python3.5/site-packages/flask_sqlalchemy/__init__.py:839: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
</code></pre>

<p>Then:</p>

<pre><code>db.create_all() 
</code></pre>

<p>result:</p>

<pre><code>(psycopg2.OperationalError) FATAL:  password authentication failed for user "dbUserName"
FATAL:  password authentication failed for user "dbUserName"
</code></pre>

<p>after a lot of search in forum I found this guide:</p>

<blockquote>
  <p>in your pg_hba.conf</p>

<pre><code># IPv4 local connections:
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         127.0.0.1/32         trust
</code></pre>
</blockquote>

<p>But its not work for me.</p>
