【问题标题】:Migrate Django app on heroku: relation "filer_image" does not exist在 heroku 上迁移 Django 应用程序:关系“filer_image”不存在
【发布时间】:2015-10-26 17:28:23
【问题描述】:

我正在尝试在 heroku 上部署我的 django 应用程序。

那个使用filer,我什至在INSTALLED_APP元组中定义了它,就像in this answer所说的那样。

我一次又一次地更换 filer 名称,以便可能在我之前安装此应用程序,这样我就可以避免这个错误,但是当它全部部署在 heroku 上时,我一直收到这个错误。

当我尝试迁移数据库时,我得到了这个:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 351, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 343, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
    call_command("migrate", **options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 318, in sync_apps
    cursor.execute(statement)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/six.py", line 658, in reraise
    raise value.with_traceback(tb)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "filer_image" does not exist

知道问题出在哪里吗?

我的 Django 版本是 1.8.5

【问题讨论】:

    标签: python django heroku


    【解决方案1】:

    您是否尝试过运行:

    python manage.py syncdb
    

    迁移完成后?

    编辑: 如果您对架构进行了任何更改,您还需要运行:

    python manage.py schemamigration appname --auto
    

    然后再次迁移。

    【讨论】:

    • 我收到Unknown command: 'schemamigration'。供您参考,我的 Django 版本是 1.8.5
    • 同步数据库还不够吗?要进行架构迁移,您需要在项目中安装 South 并将其添加到已安装的应用程序中。抱歉没有早点告诉你。 :)
    • 然后我得到There is no South database module 'south.db.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS. ;如果它可以帮助我,我如何从头开始部署数据库?
    • 哦,在这里您应该运行“pip uninstall South”,它可能会解决您的问题。但原来的问题依然存在。您能否提供有关您所做的更改或您创建的模型的更多信息?
    猜你喜欢
    • 2016-03-17
    • 2017-07-01
    • 2019-02-04
    • 2017-03-25
    • 2019-04-17
    • 2012-04-26
    • 2015-10-05
    • 2016-11-03
    相关资源
    最近更新 更多