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

简介: 1、进入页面,提示Creating a ModelForm without either the 'fields' attribute or the 'exclude'时 解决方法:打开forms.py文件,修改如下: class TestModelForm(forms.

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数据库同步后,开启服务即可。

 

技术改变世界! --狂诗绝剑
目录
相关文章
|
10月前
|
Python
PyCharm在用Django开发时debug模式启动失败显示can't find '__main__' module的解决方法
初次用Django开发web应用,在试图用Pycharm进行debug的时候,出现了一个奇怪的问题。以正常模式启动或者在terminal启动都没有问题。但是以debug模式启动时,显示`can't find '__main__' module”`报错。在网上找了很久都没有看到解决方法,最后在某乎上看到一篇文章,在启动时加上`--noreload`参数,既可以debug模式启动。
137 0
|
2月前
|
开发框架 人工智能 前端开发
使用Python、Django和Bootstrap构建在线教育平台
使用Python、Django和Bootstrap构建在线教育平台
103 0
|
2月前
|
前端开发 JavaScript Python
Web实战:基于Django与Bootstrap的在线计算器
Web实战:基于Django与Bootstrap的在线计算器
108 0
N..
|
2月前
|
开发框架 前端开发 UED
Bootstrap的CSS组件
Bootstrap的CSS组件
N..
23 0
|
9月前
|
前端开发 容器
|
9月前
|
前端开发 容器
|
9月前
|
前端开发 开发者 容器