无法在 Django 管理或通过 post 方法使用文件字段更新模型

问题描述 投票:0回答:1

我在生产环境有一个Django应用。当我通过 IP 地址使用 runserver 时它工作正常,即使在生产环境中也是如此。但是当我尝试通过域访问它时,它不允许我更新文件字段(图像字段),请求花费的时间太长,我不断收到

 <method 'read' of 'lsapi_wsgi.InputStream' objects> returned NULL without setting an error
在我的错误日志中 它甚至不允许我登录 PC 上的 Django 管理页面(仅限移动设备)。
完整跟踪错误

SystemError at /admin/accounts/user/1/change/
<method 'read' of 'lsapi_wsgi.InputStream' objects> returned NULL without setting an error
Request Method: POST
Request URL:    https://dev.temarico.com/admin/accounts/user/1/change/
Django Version: 4.1.7
Exception Type: SystemError
Exception Value:    
<method 'read' of 'lsapi_wsgi.InputStream' objects> returned NULL without setting an error
Exception Location: /home/temaricocom/virtualenv/API/Backends/3.8/lib/python3.8/site-packages/django/core/handlers/wsgi.py, line 28, in _read_limited
Raised during:  django.contrib.admin.options.change_view
Python Executable:  /home/temaricocom/virtualenv/API/Backends/3.8/bin/python
Python Version: 3.8.12
Python Path:    
['/home/temaricocom/API/Backends',
 '',
 '/home/temaricocom/API/Backends',
 '/opt/alt/python38/lib64/python38.zip',
 '/opt/alt/python38/lib64/python3.8',
 '/opt/alt/python38/lib64/python3.8/lib-dynload',
 '/home/temaricocom/virtualenv/API/Backends/3.8/lib64/python3.8/site-packages',
 '/home/temaricocom/virtualenv/API/Backends/3.8/lib/python3.8/site-packages']
Server time:    Sun, 19 Mar 2023 09:45:19 +0300
django uwsgi wsgi django-wsgi
1个回答
0
投票

不知道有没有同样的方法解决问题。但是前段时间我在我的 web flask 应用程序中遇到了同样的问题。我无法将图像上传和更新到数据库。然后我尝试通过刷新 LSChache 来清除缓存,重新启动分离的 PHP 进程(在 LiteSpeed Web 缓存管理器中),然后在 CPanel 选项菜单中重新启动 Python 应用程序。之后问题就解决了。

© www.soinside.com 2019 - 2024. All rights reserved.