Django cannot sync after create drop / create database

I wanted to reset the database and released a forwarding database, followed by the create database on the postgresql server, accessible through psycopg2 by the django application.

When i do. /manage.py syncdb, I get the following error:

(prod) root@ns204612 :/home/someproject/prod/django-mingus/mingus# ./manage.py syncdb Traceback (most recent call last): File "./manage.py", line 16, in <module> execute_manager(settings) File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager utility.execute() File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/__init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/base.py", line 222, in execute output = self.handle(*args, **options) File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle return self.handle_noargs(**options) File "/home/someproject/prod/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 52, in handle_noargs tables = connection.introspection.table_names() File "/home/someproject/prod/lib/python2.6/site-packages/django/db/backends/__init__.py", line 491, in table_names return self.get_table_list(cursor) File "/home/someproject/prod/lib/python2.6/site-packages/django/db/backends/postgresql/introspection.py", line 30, in get_table_list AND pg_catalog.pg_table_is_visible(c.oid)""") File "/home/someproject/prod/lib/python2.6/site-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block 

and in postgresql log I got the following error:

 2010-01-24 01:08:02 CET ERROR: relation "django_site" does not exist 2010-01-24 01:08:02 CET STATEMENT: SELECT "django_site"."id", "django_site"."domain", "django_site"."name" FROM "django_site" WHERE "django_site"."id" = 1 ORDER BY "django_site"."domain" ASC 2010-01-24 01:08:02 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2010-01-24 01:08:02 CET STATEMENT: SELECT c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r', 'v', '') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid) 2010-01-24 01:08:02 CET LOG: could not receive data from client: Connection reset by peer 2010-01-24 01:08:02 CET LOG: unexpected EOF on client connection 

How can i fix this?

+4
source share
5 answers

The reason for this was the problem in django-request, which is used by Django-Mingus. During syncdb, Django does some introspection of the db and the associated import that caused this exception. If you want to pull the last bits from django-request or django-mingus, you'll be fine.

0
source

Try resetting your database, for example. /manage.py reset your_app

0
source

I had the same problem and tracked it to commit on 2979ea3d4541f7b3c51c17e160bc95b468ac999b on django-mingus

If you reset back to commit 2f7eb8de7e2cb1c776e801a40f008048fcbb6d36, synchronization should happen fine.

0
source

mySQL does not invalidate the current transaction when it encounters an error, when postgres throws an error and does not start another query until the current transaction is aborted. In this case, you need to kill the transaction or complete the transaction with the transaction ID

0
source

Source: https://habr.com/ru/post/1299216/


All Articles