代码之家  ›  专栏  ›  技术社区  ›  Ilya Bibik

迁移应用程序中的URL。。。没有迁移类

  •  0
  • Ilya Bibik  · 技术社区  · 7 年前

    当我尝试运行迁移时 "Migration urls in app *** has no Migration class" ? 我刚刚添加了新应用程序。

    不知道该往哪个方向看。回溯:

    C:\Users\PAPA\DEV\liberty\lib\site-packages\django\db\models\__init__.py:55:
    RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated 
    in favor of the new application loading system.
    from . import loading
    
    Traceback (most recent call last):   File "manage.py", line 22, in <module>
        execute_from_command_line(sys.argv)
    File "...\django\core\management\__init__.py", line 338, in execute_from_command_line
        utility.execute()
    File "...\django\core\management\__init__.py", line 330, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
    File "...\django\core\management\base.py", line 390, in run_from_argv
        self.execute(*args, **cmd_options)
    File "...\django\core\management\base.py", line 441, in execute
        output = self.handle(*args, **options)
    File "...\django\core\management\commands\makemigrations.py", line 63, in handle
        loader = MigrationLoader(None, ignore_no_migrations=True)
    File "...\django\db\migrations\loader.py", line 47, in __init__
        self.build_graph()
    File "...\django\db\migrations\loader.py", line 174, in build_graph
        self.load_disk()
    File "...\django\db\migrations\loader.py", line 109, in load_disk
        "Migration %s in app %s has no Migration class" % (migration_name, app_config.label)
    django.db.migrations.loader.BadMigrationError: Migration urls in app expense has no
    Migration class
    
    1 回复  |  直到 7 年前
        1
  •  7
  •   hynekcer    5 年前


    BadMigrationError: "Migration *** in app *** has no Migration class"
    如果 "migrations/" 应用程序的目录包含一个文件 不是有效的迁移文件 .

    在您的例子中,它是应用程序“expense”迁移中的一个文件“url.py”。