django文件图片上传部署异常

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fancychuan/article/details/82666524

使用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

猜你喜欢

转载自blog.csdn.net/fancychuan/article/details/82666524