0

我正在尝试将添加到我在 Heroku 上的项目中。我按照以下步骤操作。

heroku run easy_install South

添加'south'INSTALLED_APPS_settings.py

然后

heroku run ./manage.py syncdb
heroku run ./manage.py convert_to_south sheets

追溯

Running `./manage.py convert_to_south sheets` attached to terminal... up, run.2005
Creating migrations directory at '/app/sheets/migrations'...
Creating __init__.py in '/app/sheets/migrations'...
 + Added model sheets.Sheets
 + Added model sheets.UserSheets
 + Added M2M table for users on sheets.UserSheets
 + Added model sheets.SheetScribble
 + Added model sheets.SheetScribbleComment
 + Added model sheets.Tasks
 + Added model sheets.TaskComment
Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate sheets
 - Soft matched migration 0001 to 0001_initial.
Running migrations for sheets:
- Nothing to migrate.
 - Loading initial data for sheets.
Installed 0 object(s) from 0 fixture(s)

App 'sheets' converted. Note that South assumed the application's models matched the database
(i.e. you haven't changed it since last syncdb); if you have, you should delete the sheets/migrations
directory, revert models.py so it matches the database, and try again.

然后当我尝试将我的第二个应用程序转换为南时,

heroku run ./manage.py convert_to_south scribbler

我收到这个错误

Running `./manage.py convert_to_south scribbler` attached to terminal... up, run.6046
Creating migrations directory at '/app/scribbler/migrations'...
Creating __init__.py in '/app/scribbler/migrations'...
 + Added model scribbler.ScribbleMedia
 + Added model scribbler.Scribble
 + Added model scribbler.Tag
 + Added M2M table for scribbles on scribbler.Tag
 + Added model scribbler.SharedScribble
 + Added M2M table for users_favored on scribbler.SharedScribble
 + Added model scribbler.ScribbleComment
 + Added model scribbler.Connections
 + Added unique constraint for ['following', 'followers'] on scribbler.Connections
 + Added model scribbler.UserProfile
 + Added model scribbler.Invitation
 + Added model scribbler.Notifications
Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate scribbler
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/management/commands/convert_to_south.py", line 87, in handle
    delete_ghosts=options.get("delete_ghosts", False),
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/management/commands/migrate.py", line 108, in handle
    ignore_ghosts = ignore_ghosts,
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/migration/__init__.py", line 193, in migrate_app
    applied_all = check_migration_histories(applied_all, delete_ghosts, ignore_ghosts)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/migration/__init__.py", line 74, in check_migration_histories
    m = h.get_migration()
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/models.py", line 34, in get_migration
    return self.get_migrations().migration(self.migration)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/models.py", line 31, in get_migrations
    return Migrations(self.app_name)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/migration/base.py", line 61, in __call__
    self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/migration/base.py", line 89, in __init__
    self.set_application(application, force_creation, verbose_creation)
  File "/app/.heroku/venv/lib/python2.7/site-packages/south/migration/base.py", line 161, in set_application
    raise exceptions.NoMigrations(application)
south.exceptions.NoMigrations: Application '<module 'sheets' from '/app/sheets/__init__.py'>' has no migrations.

我不确定问题是什么。

4

1 回答 1

1

您不应该在 heroku 上运行这些命令。您应该在本地环境中执行此操作,将它们推送到 heroku,然后运行迁移命令。

它有一个“临时文件系统”,可能在这两个命令之间清除。所以南有0001迁移的记录,但不存在。

我不确定为什么在“convert_to_south”命令(一些新的南方功能?)期间抛出它,但这是我最好的猜测。

尝试在本地执行此操作,提交迁移文件,然后继续在 heroku 上运行迁移命令。

于 2012-11-27T07:16:30.410 回答