2012-11-12 114 views
2

我嘗試使用manage.py runserver啓動我的django開發服務器時出現問題。這是我第一次嘗試運行服務器,因爲我是django的新手。我得到以下錯誤: 驗證模型...啓動django開發服務器

Unhandled exception in thread started by <bound method Command.inner_run of <dja 
ngo.contrib.staticfiles.management.commands.runserver.Command object at 0x000000 
00033E8278>> 
Traceback (most recent call last): 
    File "C:\Python33\lib\site-packages\django\core\management\commands\runserver. 
py", line 92, in inner_run 
    self.validate(display_num_errors=True) 
    File "C:\Python33\lib\site-packages\django\core\management\base.py", line 277, 
in validate 
    num_errors = get_validation_errors(s, app) 
    File "C:\Python33\lib\site-packages\django\core\management\validation.py", lin 
e 32, in get_validation_errors 
    for (app_name, error) in get_app_errors().items(): 
    File "C:\Python33\lib\site-packages\django\db\models\loading.py", line 164, in 
get_app_errors 
    self._populate() 
    File "C:\Python33\lib\site-packages\django\db\models\loading.py", line 70, in 
_populate 
    self.load_app(app_name, True) 
    File "C:\Python33\lib\site-packages\django\db\models\loading.py", line 94, in 
load_app 
    models = import_module('.models', app_name) 
    File "C:\Python33\lib\site-packages\django\utils\importlib.py", line 35, in im 
port_module 
    __import__(name) 
    File "C:\Python33\lib\site-packages\django\contrib\auth\models.py", line 15, i 
n <module> 
    from django.contrib.auth.hashers import (
    File "C:\Python33\lib\site-packages\django\contrib\auth\hashers.py", line 8, i 
n <module> 
    from django.test.signals import setting_changed 
    File "C:\Python33\lib\site-packages\django\test\__init__.py", line 6, in <modu 
le> 
    from django.test.testcases import (TestCase, TransactionTestCase, 
    File "C:\Python33\lib\site-packages\django\test\testcases.py", line 923, in <m 
odule> 
    _ImprovedEvent = threading._Event 
AttributeError: 'module' object has no attribute '_Event' 

請幫忙....

回答

2

您收到此錯誤消息,因爲你使用Python 3

Django的1.5將有對Python 3.x的實驗性支持。如果您使用的是早期版本的Django,那麼您必須改爲使用Python 2.x。

+0

非常好聽:) – KevinDTimm

+0

[Python 2.7是最合適的](https://docs.djangoproject.com/en/dev/releases/1.4/#python-compatibility) –

+0

@goliney它取決於哪個(if任何)python都附帶了os,但在這種情況下,在op使用Windows的地方,我同意2.7是最好的選擇。 – Alasdair