我是 python/django 菜鸟,在尝试学习时无法运行我的代码。请让我知道如何解决我遇到的以下两个错误,谢谢。
在我的新项目的根文件夹中,我在命令行上键入它,这就是发生的事情:
python manage.py 运行服务器
验证模型...
>/Users/MyClean/anaconda/lib/python2.7/site-packages/django/utils/hashcompat.py:9: DeprecationWarning: django.utils.hashcompat is deprecated; use hashlib instead
DeprecationWarning)
>Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x101a00c50>>
Traceback (most recent call last):
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
self.load_app(app_name, True)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/djangodblog/models.py", line 40, in <module>
class ErrorBase(Model):
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/djangodblog/models.py", line 46, in ErrorBase
url = models.URLField(verify_exists=False, null=True, blank=True)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1277, in __init__
CharField.__init__(self, verbose_name, name, **kwargs)
File "/Users/MyClean/anaconda/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 626, in __init__
super(CharField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'verify_exists''
我查看了我的项目代码(它非常基本),没有看到任何拼写错误。我是从一本 3 年前的书上复制的,所以我认为这是一个兼容性问题。