background_task_completedtask не существует - PullRequest
0 голосов
/ 12 июля 2020

при выполнении фоновой задачи в python django он показывает мне эту ошибку. почему background_task_completedtask не создается brackgroud_task в моделях.

    /Users/getmyparking/Documents/workspace/env_new/bin/python /Users/getmyparking/Documents/workspace/enable_backend/enable_backend/manage.py process_tasks
Rescheduling backendV2.tasks.operator_login_api
Traceback (most recent call last):
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1146, "Table 'hybrid-staging.background_task_completedtask' doesn't exist")

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

Traceback (most recent call last):
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/background_task/tasks.py", line 48, in bg_runner
    completed = task.create_completed_task()
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/background_task/models.py", line 278, in create_completed_task
    completed_task.save()
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/base.py", line 808, in save
    force_update=force_update, update_fields=update_fields)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/base.py", line 838, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/base.py", line 924, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/base.py", line 963, in _do_insert
    using=using, raw=raw)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/query.py", line 1079, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1112, in execute_sql
    cursor.execute(sql, params)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/Users/getmyparking/Documents/workspace/env_new/lib/python3.7/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'hybrid-staging.background_task_completedtask' doesn't exist")
Rescheduling task backendV2.tasks.operator_login_api for 0:00:21 later at 2020-07-12 15:22:04.101148

даже при выполнении makemigrations и миграции оба бесполезны, в этом случае он показывает Нет изменений обнаружено.

1 Ответ

0 голосов
/ 15 июля 2020

вы запускали python manage.py migrate?
См. Шаги здесь .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...