@Kosyak26

Ошибки после подключения к базе данных?

Здравствуйте, с Django работаю недавно, к сути. Создал проект, прописал подключение к БД
spoiler
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'fn',
        'USER' : 'postgres',
        'PASSWORD' : 'admin',
        'HOST' : '##.##.#.###',
        'PORT' : '5432',
    }
}

После чего попытался запустить сервер, консоль выдает такую ошибку

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
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

Возможности обновить к сожалению нету.
Версии Django и Python последние
  • Вопрос задан
  • 164 просмотра
Решения вопроса 1
@galaxy
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...
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы