定义的数据库找不到NameError at /msg/msgsolve/ name 'CloudMsg' is not defined Request Method: GET Request URL: http://127.0.0.1:8000/msg/msgsolve/ Django Version: 2.2.4 Exception Type: NameError Exception Value: name 'CloudMsg' is not defined Exception Location: C:\Users\HUAWEI\Desktop\新建文件夹\message\msg\views.py in msgsolve, line 17 Python Executable: C:\Users\HUAWEI\AppData\Local\Programs\Python\Python310-32\python.exe Python Version: 3.10.11 Python Path: ['C:\\Users\\HUAWEI\\Desktop\\新建文件夹\\message', 'C:\\Users\\HUAWEI\\AppData\\Local\\Programs\\Python\\Python310-32\\python310.zip', 'C:\\Users\\HUAWEI\\AppData\\Local\\Programs\\Python\\Python310-32\\DLLs', 'C:\\Users\\HUAWEI\\AppData\\Local\\Programs\\Python\\Python310-32\\lib', 'C:\\Users\\HUAWEI\\AppData\\Local\\Programs\\Python\\Python310-32', 'C:\\Users\\HUAWEI\\AppData\\Local\\Programs\\Python\\Python310-32\\lib\\site-packages'] Server time: Tue, 6 Jun 2023 12:37:05 +0000
时间: 2023-07-06 13:36:09 浏览: 186
这个错误通常发生在没有正确导入模块或类的情况下。请确保在views.py文件中导入了CloudMsg类。例如,如果CloudMsg类在models.py文件中,请在views.py文件的开头添加以下代码:
```
from .models import CloudMsg
```
如果还有其他导入语句,请确保它们也正确。如果问题仍然存在,请检查models.py文件是否存在并包含CloudMsg类的定义。
阅读全文