上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: ```pythonDjango model 字段类型及选项解析(一)字段类型选择: AutoField(Field) - int自增列,必须填入参数 primary_key=True BigAutoField(AutoField) - bigint自增列,必须填入参数 primary_key=True 注:当model中如果没有自增列,则自动会... 阅读全文
posted @ 2020-04-01 16:52 大海一个人听 阅读(235) 评论(0) 推荐(0) 编辑
摘要: ```python Django中blank=True和null=True的区别 null 是针对数据库而言,如果 null=True, 表示数据库的该字段可以为空,那么在新建一个model对象的时候是不会报错的!! blank 是针对表单的,如果 blank=True,表示你的表单填写该字段的时候可以不填 ``` 阅读全文
posted @ 2020-04-01 12:34 大海一个人听 阅读(458) 评论(0) 推荐(0) 编辑
摘要: ```python这个问题在Python3.6有时候会出现,说明是源码有bug这一块Your STATICFILES_DIRS setting is not a tuple or list; "ImproperlyConfigured: Your STATICFILES_DIRS setting is not a tuple or list; perhaps you forgot a traili... 阅读全文
posted @ 2020-03-31 21:54 大海一个人听 阅读(787) 评论(0) 推荐(0) 编辑
摘要: ```python【部署问题】解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid" failed(2:No such file or directory)解决方法:终端上直接输入下面这一句话执行命令就可以了,个人验证,亲测有效/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/ngi... 阅读全文
posted @ 2020-03-27 09:52 大海一个人听 阅读(928) 评论(0) 推荐(0) 编辑
摘要: ```python git add . 的时候遇到warning: LF will be replaced by CRLF in ...... 解决办法 输 入 git add . 后出现 warning: LF will be replaced by CRLF in ...... The file will have its original line endings in your worki 阅读全文
posted @ 2020-03-26 12:59 大海一个人听 阅读(613) 评论(0) 推荐(0) 编辑
摘要: ```python 运行环境 PyCharm 2017.1 Django 2.0.1 python 3.6.1 使用相对路径引用Models模块 from .models import * 1 在同时存在多个apps的情况下,有机会报错 RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_labe 阅读全文
posted @ 2020-03-12 17:56 大海一个人听 阅读(1658) 评论(0) 推荐(0) 编辑
摘要: 报错信息: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient? 解决方式: 在settings.py配置文件中,添加pymysql的配置, im 阅读全文
posted @ 2020-03-04 21:38 大海一个人听 阅读(2036) 评论(0) 推荐(0) 编辑
摘要: ```python django的类视图拥有自动查找指定方法的功能,通过调用as_views()方法实现。 在探讨这个问题之前,先引入一段代码举个例子方便理解: 一般请求的判断方法: def View(request,*args,**kwargs): if request.method.lower() == 'get': do_something() if request.method.lower 阅读全文
posted @ 2019-12-31 21:13 大海一个人听 阅读(379) 评论(0) 推荐(0) 编辑
摘要: ```python 序列化家族 Serializer序列化(了解) 视图类 Serializer反序列化(了解) 视图类 序列化类 ModelSerializer序列化与反序列化(重点) 视图类 序列化类 模型类 序列化家族 """ 1、Serializer类:底层序列化类 - 了解类 重点:单表序列化 2、ModelSerializer类:模型序列化类 - 核心类 重点:多表序列化 3、List 阅读全文
posted @ 2019-12-30 08:52 大海一个人听 阅读(163) 评论(0) 推荐(0) 编辑
摘要: ```python 断关联表关系 外键字段属性 多表操作 断关联表关系 ''' 1.不会影响连表查询操作效率 2.会提升连表增删改操作效率 3.易于后期数据库表的重构 4.缺点:数据库本身设有连表检测,容易出现脏数据,需要通过严格的逻辑避免脏数据的参数(必要的时候管理脏数据) 举例: A依赖B,先插入A记录,该记录对应的B记录没产生,在没有关联的情况下,该操作可以实现,但是数据就是脏数据。接着再将 阅读全文
posted @ 2019-12-30 08:45 大海一个人听 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页