9

最初の南部への移行を適用しようとするとエラーが発生します。私はさまざまな提案を試みました(移行フォルダー内の .pyc ファイルの削除、アプリの変換、アプリの再起動、その他のフィドルなど)。ここで誰かが私ができることを提案できますか? ありがとう

(env)~/code/django/ssc/dev/ssc/ssc> python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 108, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.7/dist-packages/south/migration/__init__.py", line 166, in migrate_app
    Migrations.calculate_dependencies()
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 228, in calculate_dependencies
    migration.calculate_dependencies()
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 362, in calculate_dependencies
    for migration in self._get_dependency_objects("depends_on"):
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 342, in _get_dependency_objects
    for app, name in getattr(self.migration_class(), attrname, []):
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 314, in migration_class
    return self.migration().Migration
AttributeError: 'module' object has no attribute 'Migration'
(env)~/code/django/ssc/dev/ssc/ssc> python manage.py convert_to_south crewcal
This application is already managed by South.
(env)~/code/django/ssc/dev/ssc/ssc> python manage.py migrateTraceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 108, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.7/dist-packages/south/migration/__init__.py", line 166, in migrate_app
    Migrations.calculate_dependencies()
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 228, in calculate_dependencies
    migration.calculate_dependencies()
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 362, in calculate_dependencies
    for migration in self._get_dependency_objects("depends_on"):
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 342, in _get_dependency_objects
    for app, name in getattr(self.migration_class(), attrname, []):
  File "/usr/local/lib/python2.7/dist-packages/south/migration/base.py", line 314, in migration_class
    return self.migration().Migration
AttributeError: 'module' object has no attribute 'Migration'
4

3 に答える 3

17

私の場合、AttributeError: 'module' object has no attribute 'Migration'エラーは、単に移行フォルダーに余分な .py ファイルがあるという問題でした。

移行ディレクトリに追加のユーティリティ モジュールがあり、South が詰まる原因になりました。モジュールを別のディレクトリ (アプリの移行ディレクトリの上) に移動すると、問題が解決しました。

于 2013-03-13T03:55:35.327 に答える
3

少し遅いかもしれませんが、それでも...__init__.py移行パッケージに他のパッケージ ( のフォルダー) があり、構造に干渉している可能性はありますか?

于 2013-01-24T14:34:22.133 に答える