OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user
<p>I'm relatively new to python and postgresql. I have inherited some code (python) that built a postgresql database using psycopg2 and sqlalchemy. </p>

<p>The database is named <code>'tetradev'</code> with user <code>'tetra'</code></p>

<p>On top of this is a browser based application running via flask that queries the database to load information on a map. </p>

<p>I recently changed the password for the user <code>'tetra'</code> and now I get a </p>

<blockquote>
  <p>"Internal Server Error The server encountered an internal error and
  was unable to complete your request. Either the server is overloaded
  or there is an error in the application"</p>
</blockquote>

<p>on the URL. </p>

<p>Through the server where this is all hosted I get a </p>

<blockquote>
  <p>"OperationalError: (psycopg2.OperationalError) FATAL: password
  authentication failed for user
  " error.</p>
</blockquote>

<p>However, via the terminal, I have no issues connecting to <code>'tetradev'</code> via user <code>'tetra'</code> directly. </p>

<p>Any ideas on how to fix this?</p>

<p><strong>Edit</strong></p>

<p>Below are the settings in the config file.</p>

<pre><code>db_NAME = os.getenv(‘db_NAME', ‘tetradev')
db_USER = os.getenv(‘db_USER', ’tetra’)
db_PASSWD = os.getenv(‘db_PASSWD', 'default')
db_HOST = os.getenv(‘db_HOST', ‘xxx.xx.xxx.xx’)
db_PORT = os.getenv(‘db_PORT', 5432)
</code></pre>