Django南部移民属性错误

Django南部移民属性错误,django,migration,django-south,attributeerror,Django,Migration,Django South,Attributeerror,我在Django(1.4)向南迁移(0.7.5)时遇到了这个错误。我最近将时区设置更改为false,即使用_TZ=false修复另一个问题。有什么想法吗?谢谢 ~/code/django/ssc/dev/ssc/ssc: python manage.py migrate crewcal Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command

我在Django(1.4)向南迁移(0.7.5)时遇到了这个错误。我最近将时区设置更改为false,即使用_TZ=false修复另一个问题。有什么想法吗?谢谢

~/code/django/ssc/dev/ssc/ssc: python manage.py migrate crewcal
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/migration/__init__.py", line 158, in migrate_app
    Migrations.calculate_dependencies()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/migration/base.py", line 227, in calculate_dependencies
    migration.calculate_dependencies()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/migration/base.py", line 355, in calculate_dependencies
    for migration in self._get_dependency_objects("depends_on"):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/migration/base.py", line 335, in _get_dependency_objects
    for app, name in getattr(self.migration_class(), attrname, []):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/south/migration/base.py", line 307, in migration_class
    return self.migration().Migration
AttributeError: 'module' object has no attribute 'Migration'
~/code/django/ssc/dev/ssc/ssc: 
~/code/django/ssc/dev/ssc/ssc:python manage.py migrate crewcal
回溯(最近一次呼叫最后一次):
文件“manage.py”,第10行,在
从命令行(sys.argv)执行命令
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/django/core/management/_init__.py”,第443行,从命令行执行
utility.execute()
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/django/core/management/_init__.py”,执行中第382行
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py”,第196行,运行于_argv
self.execute(*args,**选项._dict__;
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/django/core/management/base.py”,执行中的第232行
输出=self.handle(*args,**选项)
handle中的文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/management/commands/migrate.py”,第105行
忽略重影=忽略重影,
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/migration/_init__.py”,第158行,在migrate_应用程序中
迁移。计算_依赖项()
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/migration/base.py”,第227行,位于calculate\u dependencies中
迁移。计算_依赖项()
File“/lib/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/migration/base.py”,第355行,计算\u依赖项
用于自迁移。获取依赖对象(“依赖”):
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/migration/base.py”,第335行,位于“获取依赖关系”对象中
对于应用程序,getattr中的名称(self.migration_class(),attrname,[]):
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/south/migration/base.py”,第307行,在migration_类中
返回self.migration().migration
AttributeError:“模块”对象没有“迁移”属性
~/code/django/ssc/dev/ssc/ssc:

可能太晚了,但我认为这与TZ无关

每个迁移文件都有如下声明:

class Migration(SchemaMigration):
    ...
AttributeError
来自未找到声明的迁移类

检查是否所有迁移都有这样的迁移。否则请提供更多详细信息。

对于second的回答,错误实际上是因为South无法在迁移模块中找到迁移的实现。这是一条一般的Python错误消息:

AttributeError: 'module' object has no attribute 'Migration'
错误被抛出,现在在第315行(版本0.8.4)

调试打印输出 不幸的是,
python manage.py migrate
没有告诉您哪个文件受到影响。您可以在
/local/lib/python*/site packages/south/migration/base.py
的第315行上方添加以下代码。这将告诉您必须处理哪个文件

print('## MODULE: %s' % str(self.migration()))
特例 我遇到了一个特殊情况,
AttributeError
出现在
migrations//\uuu init\uuuuuuuu.py
中,它通常被认为只是一个空文件。在我向我的应用程序添加了一个空模型文件
model.py
,诱使Django查看我的应用程序的
fixtures
文件夹后,该空文件停止工作(请参阅)。我相信这实际上是一只南方虫子

解决方案 如上所述,找出受影响的迁移模块,只需在该文件中添加一个
迁移类的空实现,例如:

from south.v2 import SchemaMigration


class Migration(SchemaMigration):
    def forwards(self, orm):
        pass

    def backwards(self, orm):
        pass