从django开发服务器退出时继续出错

时间:2014-09-22 11:27:44

标签: python django

我有一个django应用程序(Django == 1.6.7),运行正常后用./manage.py runserver启动它

但是当我想关闭服务器时,即我按下ctrl + c我收到以下错误:

 CTraceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 80, in handle
    self.run(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 89, in run
    autoreload.main(self.inner_run, args, options)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 181, in main
    reloader(wrapped_main_func, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 153, in python_reloader
    exit_code = restart_with_reloader()
KeyboardInterrupt

服务器停止,但我仍然收到错误。你知道为什么会发生这种情况吗?

1 个答案:

答案 0 :(得分:0)

这是因为你点击了ctrl + c。当你按ctrl + c Python引发异常(KeyboardInterrupt)时,会发生这样的错误,这个错误会停止所有正在运行的代码,在某些情况下会导致回溯。无需担心: - )

如果它一直没有发生,因为你在编辑了一些Python代码之后立即点击了ctrl + c并且Django仍在重新加载过程中。