【问题标题】:Error while running migrate for django-hordak [closed]为 django-hordak 运行迁移时出错 [关闭]
【发布时间】:2018-04-25 06:14:59
【问题描述】:

我想在我的应用程序中使用 django-hordak 用于会计目的,并按照http://django-hordak.readthedocs.io/en/latest/ 的官方教程进行操作。 我在 INSTALLED_APPS 中添加了应用程序“mptt”和“hordak”,当我运行 ./manage.py migrate 时,它​​在控制台上抛出以下错误:

请帮忙!

谢谢

【问题讨论】:

  • 试试pip install sqlparse

标签: python django pip


【解决方案1】:

如错误消息中所述

没有名为“sqlparse”的模块

下面的异常告诉你:

如果您不手动拆分 SQL 语句,则需要 sqlparse

运行pip install sqlparse

【讨论】:

  • 谢谢。我试过了,但现在它给出了这个错误:Applying hordak.0002_check_leg_trigger_20160903_1149...Traceback (most recent call last): File "/home/fatah/virtualenvs/django1.10/lib/python3.5/site-packages/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql) File "/home/fatah/virtualenvs/django1.10/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 335, in execute return Database.Cursor.execute(self, query) sqlite3.OperationalError: near "OR": syntax error
  • 阅读 the requirements - 你使用 sqlite3 并且应用程序需要 postgresql。看起来它执行了 sqlite3 不理解的查询。
【解决方案2】:

解决了我的问题。它需要 postgres 作为数据库后端才能运行。在 settings.py 中添加了以下内容,然后它就可以正常工作了。

'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'accounting', 'USER': 'root', 'PASSWORD': '****', 'HOST': 'localhost', 'PORT': '', }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-29
    • 1970-01-01
    • 1970-01-01
    • 2020-01-06
    • 2017-12-17
    • 2016-08-17
    • 1970-01-01
    • 2015-04-06
    相关资源
    最近更新 更多