Django给出先前项目的404错误

时间:2019-10-02 17:45:24

标签: python django virtualenv

当我尝试启动新的Django项目并运行服务器时,我有 "SOURCE /lo-fi-radio HTTP/1.0" 404 1987,但这是一个全新的空项目,带有自己的virtualenv。 lo-fi-radio是我上一个项目的根目录。还有另一个奇怪的错误。

完整日志:

Watching for file changes with StatReloader                                                                                                                                                     
Performing system checks...                                                                                                                                                                     

System check identified no issues (0 silenced).                                                                                                                                                 

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.                                          
Run 'python manage.py migrate' to apply them.

October 02, 2019 - 17:32:41
Django version 2.2.6, using settings 'company_db_manager.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /lo-fi-radio
[02/Oct/2019 17:32:45] "SOURCE /lo-fi-radio HTTP/1.0" 404 1987
Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 333, in send_headers
    self._write(bytes(self.headers))
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
[02/Oct/2019 17:32:45] "SOURCE /lo-fi-radio HTTP/1.0" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 36856)
Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 333, in send_headers
    self._write(bytes(self.headers))
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/home/pavel/.virtualenvs/pbz/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 116, in handle_error
    super().handle_error()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 344, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/socketserver.py", line 654, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 724, in __init__
    self.handle()
  File "/home/pavel/.virtualenvs/pbz/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 169, in handle
    self.handle_one_request()
  File "/home/pavel/.virtualenvs/pbz/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 194, in handle_one_request
    handler.run(self.server.get_app())
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/home/pavel/.virtualenvs/pbz/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 111, in close
    super().close()
  File "/usr/lib/python3.6/wsgiref/simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

pip freeze在virtualenv给出

Django==2.2.6
psycopg2==2.8.3
pytz==2019.2
sqlparse==0.3.0

我什至都没猜到是什么问题,因为它是在新的空项目中发生的,而且我没有从以前的项目中复制任何文件。

UPD:重新安装virtualenv和virtualenvwrapper没有帮助

0 个答案:

没有答案