django檔案圖片上傳部署異常
阿新 • • 發佈:2018-12-09
使用django的ImageField實現圖片的上傳功能,在本地開發測試通過,但是部署到Apache的時候,就報500的錯誤。
[Wed Sep 12 16:30:19 2018] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/4.6.4 Python/3.6 configured -- resuming normal operations
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/mnt/workshop/py36env/lib/python3.6/site-packages/PIL/Image.py" , line 600, in __del__
NameError: name 'hasattr' is not defined
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/mnt/workshop/py36env/lib/python3.6/site-packages/PIL/Image.py", line 600, in __del__
NameError: name 'hasattr' is not defined
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/mnt/workshop/py36env/lib/python3.6/site-packages/PIL/Image.py", line 600, in __del__
NameError: name 'hasattr' is not defined
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/mnt/workshop/py36env/lib/python3.6/site-packages/PIL/Image.py", line 600, in __del__
NameError: name 'hasattr ' is not defined
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/mnt/workshop/py36env/lib/python3.6/site-packages/PIL/Image.py", line 600, in __del__
NameError: name 'hasattr' is not defined
[Wed Sep 12 16:33:57 2018] [notice] caught SIGTERM, shutting down
[Wed Sep 12 16:33:58 2018] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
網站找了好久也沒找到什麼解決方案,後面試了下檔案的許可權問題,竟然解決了!
chmod -R 755 /mnt/workshop/your_project_path
chown -R apache:apache /mnt/workshop/your_project_path