qq_36932763
qq_934321800
2017-08-08 02:33

python3 django models 调用出错

1
  • python
  • django

图片说明![图片说明](https://img-ask.csdn.net/upload/201708/08/1502159234_483138.png)图片说明参考连接

models.py

from django.db import models
class Test(models.Model):
name = models.CharField(max_length=20)
#testdb.py
from django.http import HttpResponse
from TestModel.models import Test

数据库操作

def testdb(request):
test1 = Test(name='runoob')
test1.save()
return HttpResponse("

数据添加成功!

")

报错:ModuleNotFoundError: No module named 'Test'

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答