hacklabr / timtec

MOOC platform built with Django and Angular to deliver and manage courses, classes and student activities
GNU Affero General Public License v3.0
73 stars 64 forks source link

Conexão com o Banco de Dados #632

Closed sistelvis closed 4 years ago

sistelvis commented 4 years ago

Estou usando o Debian 10 e o Postgresql 11, estou com o seguinte problema. Quando rodo o procedimento make create-production, aparece um erro de conexão com o banco de dados: Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/root/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 354, in execute_from_command_line utility.execute() File "/root/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/root/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv self.execute(*args, cmd_options) File "/root/env/local/lib/python2.7/site-packages/raven/contrib/django/management/init.py", line 41, in new_execute return original_func(self, *args, *kwargs) File "/root/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(args, options) File "/root/env/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle call_command("migrate", options) File "/root/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 120, in call_command return command.execute(*args, *defaults) File "/root/env/local/lib/python2.7/site-packages/raven/contrib/django/management/init.py", line 41, in new_execute return original_func(self, args, kwargs) File "/root/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(*args, options) File "/root/env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/root/env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in init self.loader = MigrationLoader(self.connection) File "/root/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in init self.build_graph() File "/root/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 191, in build_graph self.applied_migrations = recorder.applied_migrations() File "/root/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations self.ensure_schema() File "/root/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): File "/root/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 164, in cursor cursor = self.make_cursor(self._cursor()) File "/root/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor self.ensure_connection() File "/root/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection self.connect() File "/root/env/local/lib/python2.7/site-packages/django/db/utils.py", line 98, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/root/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection self.connect() File "/root/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect self.connection = self.get_new_connection(conn_params) File "/root/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection connection = Database.connect(conn_params) File "/root/env/local/lib/python2.7/site-packages/psycopg2/init.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: FATAL: Peer authentication failed for user "timtec-production"

make: *** [Makefile:62: create-production] Error 1

sistelvis commented 4 years ago

Edite o arquivo pg_hba.conf com somente esta entrada, comente as demais: local timtec-production timtec-production trust