PyCharm manage.py运行服务器错误

问题描述

| 很抱歉问一个菜鸟问题,但我不知道为什么会这样。 我刚刚重新安装了Django 1.3,并且是第一次尝试PyCharm。当我从Terminal运行
python manage.py runserver
时,一切顺利,但是,如果我尝试在PyCharm中运行
runserver
,则会得到以下信息:
Importing Django settings module settings
Traceback (most recent call last):
Validating models...

0 errors found
Django version 1.3,using settings \'glist.settings\'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
  File \"/Applications/PyCharm 1.2.1.app/helpers/pycharm/django_manage.py\",line 19,in <module>
    run_module(manage_file,None,\'__main__\')
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\",line 180,in run_module
    fname,loader,pkg_name)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\",line 72,in _run_code
    exec code in run_globals
  File \"/Users/goon/code/glist/manage.py\",line 14,in <module>
    execute_manager(settings)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py\",line 438,in execute_manager
    utility.execute()
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py\",line 379,in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py\",line 191,in run_from_argv
    self.execute(*args,**options.__dict__)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py\",line 220,in execute
    output = self.handle(*args,**options)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py\",line 67,in handle
    self.run(*args,line 76,in run
    autoreload.main(self.inner_run,args,options)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py\",line 131,in main
    reloader(main_func,kwargs)
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py\",line 104,in python_reloader
    reloader_thread()
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py\",line 83,in reloader_thread
    ensure_echo_on()
  File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/autoreload.py\",line 77,in ensure_echo_on
    attr_list = termios.tcgetattr(fd)
termios.error: (25,\'Inappropriate ioctl for device\')

Process finished with exit code 1
请注意,这一切都是在我从浏览器中请求任何页面之前发生的。而且,正如我所说,从Terminal运行我没有问题。任何帮助将不胜感激。     

解决方法

您正在使用什么版本的pycharm?实际上,这是Django 1.3中的错误。如果您尝试以任何方式在重新加载模式下运行django,它将发生。可以通过修补django进行修复。虽然PyCharm应该自动切换到无重载模式。 阅读此内容:http://blogs.jetbrains.com/pycharm/2011/03/pycharm-1-2-1-release-candidate-py-test-2-0-buildout-1-5/     ,应用补丁。其Django 1.3.1错误。这对我适用于pYCharm 3.4.1 https://github.com/django/django/commit/3e7ce3c750