Django.db.utils.DataError:整数超出范围(WebsocketsDjango通道)

2024-10-16 20:42:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在部署一个使用django频道构建的django聊天应用程序。我已经创建了一个daphne.service文件来运行daphne命令。内容如下:

[Unit]
Description=WebSocket Daphne Service
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/home/path/to/my/workingdirectory
ExecStart=/home//path/to/my/virtualenv/python
 /home/django/path/to/virtualenv/bin/daphne -b 0.0.0.0 -p 8001 myapp.asgi:application
Restart=on-failure

[Install]
WantedBy=multi-user.target

网页加载时websocket会连接,但我一发送消息,套接字就会关闭。检查daphne.service文件的状态后,我得到以下信息:

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:return self._execute_with_wrappers(sql, params,many=False, executor=self._execute)

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:   File "/home/ubuntu/django/virtualenv2/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:     return executor(sql, params, many, context)

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:   File "/home/ubuntu/django/virtualenv2/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:     return self.cursor.execute(sql, params)

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:   File "/home/ubuntu/django/virtualenv2/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:     raise dj_exc_value.with_traceback(traceback) from exc_value

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:   File "/home/ubuntu/django/virtualenv2/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]:     return self.cursor.execute(sql, params)

Nov 25 14:48:41 ip-172-31-34-249 daphne[1165]: django.db.utils.DataError: integer out of range

有什么想法吗这里可能有什么问题? 谢谢


Tags: djangoselfiphomeexecutedbsqlreturn