gpt4 book ai didi

python - Django 服务器错误

转载 作者:太空宇宙 更新时间:2023-11-04 10:52:05 28 4
gpt4 key购买 nike

我似乎不明白为什么我突然开始列出服务器错误。有什么想法吗?

完整的追溯:

Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 221, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 66, in technical_500_response
html = reporter.get_traceback_html()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 286, in get_traceback_html
c = Context(self.get_traceback_data())
File "C:\Python27\lib\site-packages\django\views\debug.py", line 244, in get_traceback_data
frames = self.get_traceback_frames()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 390, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader,
module_name)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 371, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range
[01/Nov/2012 10:46:55] "GET /home HTTP/1.1" 500 59
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 221, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 66, in technical_500_response
html = reporter.get_traceback_html()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 286, in get_traceback_html
c = Context(self.get_traceback_data())
File "C:\Python27\lib\site-packages\django\views\debug.py", line 244, in get_traceback_data
frames = self.get_traceback_frames()
File "C:\Python27\lib\site-packages\django\views\debug.py", line 390, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader,
module_name)
File "C:\Python27\lib\site-packages\django\views\debug.py", line 371, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range

最佳答案

我无法判断您使用的是任何类型的网络服务器,还是仅使用开发服务器。在任何情况下,关闭您正在使用的任何服务器,并清理项目中的所有 .pyc 文件。重新启动网络服务器,您应该一切顺利。

最常见的情况是编译文件和源文件不匹配。至于为什么会发生这种情况,没有任何线索,但它过去发生在我身上:执行上述操作为我解决了这个问题。

关于python - Django 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13179678/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com