raise ImproperlyConfigured,exc_info [1],exc_info [2]

时间:2014-01-24 05:43:18

标签: python django django-nonrel django-mongodb-engine

我创建了一个django(1.6.1)项目并使用mongodb。当我运行python manage.py runserver 0.0.0.0:8000启动服务器时,它给了我以下错误

  File "D:\Python34\lib\importlib\__init__.py", line 129, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2186, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2169, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2158, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1209, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1133, in _exec
  File "<frozen importlib._bootstrap>", line 1432, in exec_module
  File "<frozen importlib._bootstrap>", line 1537, in get_code
  File "<frozen importlib._bootstrap>", line 1497, in source_to_code
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\Python34\lib\site-packages\django_mongodb_engine\base.py", line 234
    raise ImproperlyConfigured, exc_info[1], exc_info[2]
                              ^
SyntaxError: invalid syntax

这个错误是什么意思?

1 个答案:

答案 0 :(得分:9)

django-mongodb-engine不支持Python 3.x。

  

分类

     

...

Programming Language :: Python :: 2.5
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7

错误的含义:

Python 3.x中更改了raise statement的语法。 raise expression, expression, expression语法在Python 3.x中无效。

>>> raise ValueError, 'msg'
  File "<stdin>", line 1
    raise ValueError, 'msg'
                    ^
SyntaxError: invalid syntax

>>> raise ValueError('msg')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: msg