ProgrammingError:关系“ taggit_tag”不存在

时间:2019-04-29 04:10:17

标签: python django

遵循此软件包的指南:https://github.com/kamilgregorczyk/OrderFood

我收到错误django.db.utils.ProgrammingError:尝试迁移时不存在关系“ taggit_tag”。

完整追溯:

Traceback (most recent call last):
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "taggit_tag" does not exist
LINE 1: ...ECT "taggit_tag"."name", "taggit_tag"."name" FROM "taggit_ta...
                                                             ^
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
    django.setup()
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/apps/registry.py", line 116, in populate
    app_config.ready()
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 23, in ready
    self.module.autodiscover()
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/michael/projects/OrderFood/apps/restaurant/admin.py", line 7, in <module>
    from apps.restaurant.forms import MealForm
  File "/home/michael/projects/OrderFood/apps/restaurant/forms.py", line 8, in <module>
    class MealForm(forms.ModelForm):
  File "/home/michael/projects/OrderFood/apps/restaurant/forms.py", line 9, in MealForm
    tags = TagField()
  File "/home/michael/projects/OrderFood/apps/taggit_autocomplete/form_fields.py", line 12, in __init__
    super(TagField, self).__init__(choices, False, TagAutocomplete, label, initial, help_text, *args, **kwargs)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/forms/fields.py", line 779, in __init__
    self.choices = choices
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/forms/fields.py", line 796, in _set_choices
    value = list(value)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/models/query.py", line 1102, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/models/query.py", line 122, in __iter__
    for row in compiler.results_iter():
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 828, in results_iter
    results = self.execute_sql(MULTI)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 876, in execute_sql
    cursor.execute(sql, params)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/michael/projects/OrderFood/orderums/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "taggit_tag" does not exist
LINE 1: ...ECT "taggit_tag"."name", "taggit_tag"."name" FROM "taggit_ta...

有人可以帮忙吗?此错误发生在包装手册中的第5步(迁移)。预先感谢

0 个答案:

没有答案