【问题标题】:Run manage.py syncdb error with Django 1.5使用 Django 1.5 运行 manage.py syncdb 错误
【发布时间】:2013-02-17 16:00:53
【问题描述】:

当我将 django 从 1.4 升级到 1.5 并运行 manage.py syncdb 时,出现如下错误

$ python manage.py syncdb

/usr/local/lib/python2.7/dist-packages/django/conf/init.py:219: DeprecationWarning: You have no filters defined on the 'mail_admins' logging handler:添加隐式 debug-false-only 过滤器。见http://docs.djangoproject.com/en/dev/releases/1.4/#request-exceptions-are-now-always-logged 弃用警告)

TypeError: init() 得到了一个意外的关键字参数 'verify_exists'

非常感谢!

【问题讨论】:

    标签: django


    【解决方案1】:

    model URLFieldverify_exists 关键字参数已被删除(自 1.3.1 起已贬值)。你可以在django depreciation notes for 1.5阅读更多内容:

    django.db.models.fields.URLField.verify_exists 将被删除。由于棘手的安全和性能问题,该功能已在 1.3.1 中弃用,并且将遵循略微加快的弃用时间框架。

    简单的解决方法是在引发错误的适当models.py 中找到有问题的models.URLField,并删除verify_exists=True,即:

    # Before
    some_site = models.URLField(verify_exists=True)
    
    # After
    some_site = models.URLField()
    

    【讨论】:

      猜你喜欢
      • 2014-09-07
      • 1970-01-01
      • 1970-01-01
      • 2013-07-21
      • 2014-02-04
      • 1970-01-01
      • 2011-04-15
      • 1970-01-01
      • 2013-06-06
      相关资源
      最近更新 更多