S
S
Stepan Sidorov2020-06-25 10:20:35
Django
Stepan Sidorov, 2020-06-25 10:20:35

How to fix Django migration error?

Hey!
So I added a couple of new models, now I'm trying to make migrations with them, but I get an error

Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\makemigrations.py", line 101, in handle
    loader.check_consistent_history(connection)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\migrations\loader.py", line 283, in check_consistent_history
    applied = recorder.applied_migrations()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\migrations\recorder.py", line 73, in applied_migrations
    if self.has_table():
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\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 "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py", line 256, in cursor
    return self._cursor()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py", line 233, in _cursor
    self.ensure_connection()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection
    self.connect()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection
    self.connect()
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py", line 195, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\postgresql\base.py", line 178, in get_new_connection
    connection = Database.connect(**conn_params)
  File "C:\Users\stepan\AppData\Local\Programs\Python\Python37\lib\site-packages\psycopg2\__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError
Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-Break to quit

Some new models depend on each other, but I don't think that's the case.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_, 2020-06-25
@mrxor

It falls for you, apparently, at the moment of connection to the database. Check the settings and if the base is up.
At the same time, the sentry logger also cannot send an error to the server, the same thing here, either the sentry settings are not correct, or there is no access to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question