3

E:\pythonwebproject\pythonweb>python manage.py runserver 验证模型...

Unhandled exception in thread started by <function wrapper at 0x01DE69F0> 

Traceback (most recent call last): 

  File "C:\Python26\Lib\site-packages\django\utils\autoreload.py", line 93, in wrapper 
    fn(*args, **kwargs) 

  File "C:\Python26\Lib\site-packages\django\core\management\commands\runserver.py", line 92, in inner_r 

    self.validate(display_num_errors=True) 

  File "C:\Python26\Lib\site-packages\django\core\management\base.py", line 277, in validate 

    num_errors = get_validation_errors(s, app)

  File "C:\Python26\Lib\site-packages\django\core\management\validation.py", line 35, in get_validation_ 

    for (app_name, error) in get_app_errors().items(): 

  File "C:\Python26\Lib\site-packages\django\db\models\loading.py", line 166, in get_app_errors 

    self._populate() 

  File "C:\Python26\Lib\site-packages\django\db\models\loading.py", line 72, in _populate 
    self.load_app(app_name, True) 

  File "C:\Python26\Lib\site-packages\django\db\models\loading.py", line 96, in load_app 
    models = import_module('.models', app_name) 

  File "C:\Python26\Lib\site-packages\django\utils\importlib.py", line 35, in import_module 
    __import__(name) 

  File "C:\Python26\Lib\site-packages\django\contrib\auth\models.py", line 21, in <module> 
    from django.contrib.contenttypes.models import ContentType 

  File "C:\Python26\Lib\site-packages\django\contrib\contenttypes\models.py", line 127, in <module> 
    class ContentType(models.Model): 

  File "C:\Python26\Lib\site-packages\django\db\models\base.py", line 88, in __new__ 
    new_class.add_to_class('_meta', Options(meta, **kwargs)) 

TypeError: Error when calling the metaclass bases 
    __init__() keywords must be strings 
4

2 回答 2

2

这个错误报告是我能找到的具有类似症状的唯一资源。你用的是 django 1.5 吗?尝试将您的 python 安装升级到 2.7,看看是否可以解决问题。

于 2013-01-14T02:02:38.993 回答
1

您正在使用带有 Python 2.6 的 Django 开发版(即将发布 1.5)。它仅适用于 2.7 和 3.3。您应该升级您的 Python 版本,或者使用已发布的 Django 版本 1.4。

于 2013-01-14T08:05:14.047 回答