django搭建Bootstrap常用问题解决方法

1、进入页面,提示Creating a ModelForm without either the 'fields' attribute or the 'exclude'时

解决方法:打开forms.py文件,修改如下:

class TestModelForm(forms.ModelForm):
    class Meta:
        model = User
        #model = Author
        fields = "__all__"

2、进入页面,提示no such table xxx,没有找到该表里,

可以进到项目目录下,删除Migrations文件夹,再执行一下 python manage.py syncdb数据库同步后,开启服务即可。

原文地址:https://www.cnblogs.com/jinjiangongzuoshi/p/4818916.html