K
K
Kosyak262022-02-02 07:42:14
PostgreSQL
Kosyak26, 2022-02-02 07:42:14

Errors after connecting to database?

Hello, I've been working with Django recently, to the point. Created a project, registered a connection to the database

spoiler
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'fn',
        'USER' : 'postgres',
        'PASSWORD' : 'admin',
        'HOST' : '##.##.#.###',
        'PORT' : '5432',
    }
}

Then I tried to start the server, the console gives the following error

spoiler
E:\Рабочий стол\test-django\testst\testst\settings.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
return self.cursor.execute(sql)
psycopg2.errors.UndefinedColumn: column c.relispartition does not exist
LINE 3: CASE WHEN c.relispartition THEN 'p' WHEN c.relki...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\runserver.py", line 127, in inner_run
self.check_migrations()
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 505, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
self.build_graph()
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\loader.py", line 223, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\recorder.py", line 77, in applied_migrations
if self.has_table():
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\recorder.py", line 56, in has_table
tables = self.connection.introspection.table_names(cursor)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\introspection.py", line 52, in table_names
return get_names(cursor)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\introspection.py", line 47, in get_names
return sorted(ti.name for ti in self.get_table_list(cursor)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\postgresql\introspection.py", line 49, in get_table_list
cursor.execute("""
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 99, in execute
return super().execute(sql, params)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 80, in _execute
with self.db.wrap_database_errors:
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Name\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: column c.relispartition does not exist
LINE 3: CASE WHEN c.relispartition THEN 'p' WHEN c.relki...


postgre server version
spoiler
PostgreSQL 9.4.13 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit

Unfortunately there is no way to update.
Django and Python versions latest

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2022-02-02
@Kosyak26

PostgreSQL 9.4.13 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit

Django supports PostgreSQL 10 and higher. psycopg2 2.8.4 or higher is required, though the latest release is recommended.

https://docs.djangoproject.com/en/4.0/ref/database...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question