我剛剛設置了virtualenv來啓動django項目。我安裝好了一切。 當我發出「python manage.py runserver」時,它吐出這個錯誤。我嘗試了所有類型的django runserver錯誤,似乎沒有人會這樣做。任何人都有洞察力?Django「__init __()關鍵字必須是字符串」錯誤,同時運行「runserver」
Validating models...
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1016bb0d0>>
Traceback (most recent call last):
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/db/models/loading.py", line 72, in _populate
self.load_app(app_name, True)
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/contrib/auth/models.py", line 21, in <module>
from django.contrib.contenttypes.models import ContentType
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/contrib/contenttypes/models.py", line 127, in <module>
class ContentType(models.Model):
File "/usr/local/bin/django-hari/lib/python2.6/site-packages/Django-1.5.4-py2.6.egg/django/db/models/base.py", line 97, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
TypeError: Error when calling the metaclass bases
__init__() keywords must be strings
你試過看你的型號代碼嗎? –
你的模特有一個怪異的「Meta」類嗎? –
我沒有創建任何代碼。我只是沿着一個教程,安裝Django後,我創建了一個測試項目,並打「python manage.py runserver」並給出了這個錯誤。有沒有辦法修改模型代碼並糾正這個問題? – Krish