Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24797 closed Uncategorized (duplicate)

Cannot run migrate without access to postgres database

Reported by: wftimg Owned by: nobody
Component: Core (Management commands) Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Similar to #24791, the change for ticket #16969 prevents Django from being able to run the migrate management command when using the PostGIS database backend on shared hosts, where you are not allowed to connect to the "postgres" database.

The traceback, for reference (Django 1.8.1):

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/core/management/commands/migrate.py", line 91, in handle
    connection.prepare_database()
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/contrib/gis/db/backends/postgis/base.py", line 36, in prepare_database
    if self.template_postgis is None:
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/utils/functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/contrib/gis/db/backends/postgis/base.py", line 28, in template_postgis
    with self._nodb_connection.cursor() as cursor:
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/username/lib/python2.7/Django-1.8.1-py2.7.egg/django/db/backends/postgresql_psycopg2/base.py", line 172, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: FATAL:  no pg_hba.conf entry for host "[local]", user "username_postgis", database "postgres", SSL off

Change History (1)

comment:1 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed

The root cause is the same as #24791 and I don't think we need more than one ticket to track the issue.

Version 0, edited 10 years ago by Tim Graham (next)
Note: See TracTickets for help on using tickets.
Back to Top