Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker.env username variable not read by web container (hardcoded) #55

Open
LivingWithHippos opened this issue Oct 13, 2020 · 1 comment

Comments

@LivingWithHippos
Copy link

LivingWithHippos commented Oct 13, 2020

I modified the standard settings in docker.env but after the docker installation I get these logs. The connection is fine if I change only the db name and the password.

 File "/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 73, in applied_migrations
   if self.has_table():
 File "/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 56, in has_table
   return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 256, in cursor
   return self._cursor()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 233, in _cursor
   self.ensure_connection()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
   self.connect()
 File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
   raise dj_exc_value.with_traceback(traceback) from exc_value
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
   self.connect()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
   self.connection = self.get_new_connection(conn_params)
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
   connection = Database.connect(**conn_params)
 File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
   conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  password authentication failed for user "postgres"
/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
 """)
Traceback (most recent call last):
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
   self.connect()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
   self.connection = self.get_new_connection(conn_params)
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
   connection = Database.connect(**conn_params)
 File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
   conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  password authentication failed for user "postgres"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
 File "manage.py", line 15, in <module>
   execute_from_command_line(sys.argv)
 File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
   utility.execute()
 File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
   self.execute(*args, **cmd_options)
 File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
   output = self.handle(*args, **options)
 File "/usr/src/reminiscence/pages/management/commands/createdefaultsu.py", line 9, in handle
   if not qlist:
 File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 278, in __bool__
   self._fetch_all()
 File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all
   self._result_cache = list(self._iterable_class(self))
 File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
   results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
 File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1138, in execute_sql
   cursor = self.connection.cursor()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 256, in cursor
   return self._cursor()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 233, in _cursor
   self.ensure_connection()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
   self.connect()
 File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
   raise dj_exc_value.with_traceback(traceback) from exc_value
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
   self.connect()
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
   self.connection = self.get_new_connection(conn_params)
 File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
   connection = Database.connect(**conn_params)
 File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
   conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  password authentication failed for user "postgres"
@thprice
Copy link

thprice commented Jan 22, 2021

Just run into the same problem.
Unfortunately, the docker.env file is misleading. The db user env variable must be named POSTGRES__USER (notice the double underscores). Alternatively, you could also change it in reminiscence/dockersettings.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants