gpt4 book ai didi

python - 由于 AttributeError,我无法使用 south 同步数据库

转载 作者:搜寻专家 更新时间:2023-10-30 20:01:57 24 4
gpt4 key购买 nike

solve 之后尝试迁移时出错,现在我正面临 south 包的另一个问题。

运行 manage.py syncdbmanage.py schemamigration MyApp --initial 我得到 this :

AttributeError: 'module' object has no attribute '__file__'

This post提到问题已通过新版本 (0.8.4) 解决,但对我来说不是,因为我有最新版本。

我正在使用 python3.3 运行虚拟环境 - 有什么线索吗?


如果您没有看到链接或不想打开它,这里是纯文本的完整堆栈跟踪:

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/management/commands/schemamigration.py", line 87, in handle
migrations = Migrations(app, force_creation=True, verbose_creation=int(verbosity) > 0)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 64, in __call__
self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 90, in __init__
self.set_application(application, force_creation, verbose_creation)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 163, in set_application
self._load_migrations_module(application.migrations)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 170, in _load_migrations_module
dirname = self.migrations_dir()
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 132, in migrations_dir
return os.path.dirname(module.__file__)
AttributeError: 'module' object has no attribute '__file__'

最佳答案

为了完整起见,我在评论中突出了@rara_tiru 的回答作为答案,因为这也是我的问题:我的应用程序中也有一个迁移文件夹,当迁移文件夹被删除时,它起作用了。使用 Python 3.3/South 1.0/Django 1.6.5。

关于python - 由于 AttributeError,我无法使用 south 同步数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21037212/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com