在Ubuntu服務器上發版django報錯。

Traceback (most recent call last):
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
    request = self.request_class(environ)
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 82, in __init__
    self.method = environ['REQUEST_METHOD'].upper()
KeyError: 'REQUEST_METHOD'
[pid: 20398|app: 0|req: 1/1]  () {16 vars in 368 bytes} [Wed Jul 31 05:13:09 2019]   => generated 0 bytes in 2 msecs ( 500) 0 headers in 0 bytes (0 switches on core 0)
Traceback (most recent call last):
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
    request = self.request_class(environ)
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 82, in __init__
    self.method = environ['REQUEST_METHOD'].upper()
KeyError: 'REQUEST_METHOD'
[pid: 20401|app: 0|req: 1/2]  () {16 vars in 368 bytes} [Wed Jul 31 05:13:09 2019]   => generated 0 bytes in 1 msecs ( 500) 0 headers in 0 bytes (0 switches on core 0)
Traceback (most recent call last):
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
    request = self.request_class(environ)
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 82, in __init__
    self.method = environ['REQUEST_METHOD'].upper()
KeyError: 'REQUEST_METHOD'
[pid: 20398|app: 0|req: 2/3]  () {16 vars in 368 bytes} [Wed Jul 31 05:13:09 2019]   => generated 0 bytes in 0 msecs ( 500) 0 headers in 0 bytes (0 switches on core 0)
Traceback (most recent call last):
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
    request = self.request_class(environ)
  File "/iot/extroniot/env36/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 82, in __init__
    self.method = environ['REQUEST_METHOD'].upper()
KeyError: 'REQUEST_METHOD'

self.method = environ['REQUEST_METHOD'].upper() 的報錯,在百度上找了一圈沒有找到原因,具體找了一下兩個網址:

http://www.h5w3.com/?p=831

https://stackoverflow.com/questions/35607350/python-3-4-3-bottle-with-cgi-environrequest-method

之前一直是運行很正常的,但是不知道爲什麼這次發版就不行了。

到了最後發現是不知道爲啥項目跑出來虛擬空間的範圍。

在外面沒有相應的包。

所以:

因爲沒有安裝好相應的包。

之前都安裝到了虛擬空間裏面,但是這次不知道什麼原因,虛擬空間的都不管用了。

然後再外面包都給安裝好了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章