摘要: 当您在Django中定义一个没有指定主键的model时,Django将自动为您创建一个主键。主键设置为整数类型(integer)。如果要覆盖该字段类型,可以在每个模型(model)的基础上执行此操作。 从Django 3.2开始,您现在可以在您的设置(settings)中自定义自动创建的主键的类型。 阅读全文
posted @ 2021-10-23 20:04 蜕变_hjr 阅读(1678) 评论(0) 推荐(0)
摘要: 注:cookie:饼干,缓存:快取。 阅读全文
posted @ 2021-10-21 19:59 蜕变_hjr 阅读(243) 评论(0) 推荐(0)
摘要: 原因分析: 1、大多数情况下,这是正常现象,因为在生成迁移文件时并没有新的0001_initial.py生成,所以也就不用进行迁移了。 2、还有就是如下情形: 这种问题的出现是因为我之前已经成功在数据库中建好了表,然后把数据库或其中的若干表直接删掉了,接下来我尝试着重新删掉执行命令生成的0001_i 阅读全文
posted @ 2021-10-19 19:20 蜕变_hjr 阅读(1189) 评论(0) 推荐(0)
摘要: 问题描述: 在生成迁移文件后,接着执行迁移,出现如下错误: django.db.utils.OperationalError: (3780,Referencing column 'category_id' and referenced column 'id' in foreign key const 阅读全文
posted @ 2021-10-19 18:56 蜕变_hjr 阅读(2260) 评论(0) 推荐(0)
摘要: 问题:在mysql中查询数据时,代码如下: 1 skus = category.sku_set.filter(is_launched=True).order_by(sort_field) skus 取不到数据,提示 skus: Unable to get repr for <class 'djang 阅读全文
posted @ 2021-10-12 23:56 蜕变_hjr 阅读(169) 评论(0) 推荐(0)
摘要: 问题重现: building 'fdfs_client.sendfile' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://l 阅读全文
posted @ 2021-10-09 18:40 蜕变_hjr 阅读(377) 评论(0) 推荐(0)
摘要: 前提:已经安装好了python环境 解决方法: 1、终端执行pip install virtualenv 2、新建一个文件夹python_virtualenvs(为将来存放更多虚拟环境,方便管理),在该目录下终端执行创建环境的命令 virtualenv for_django(虚拟环境名) 命令解析: 阅读全文
posted @ 2021-10-09 16:48 蜕变_hjr 阅读(113) 评论(1) 推荐(0)
摘要: 环境:Ubuntu 20.04.3 原因分析: 先查看虚拟机openssl-server是否已安装并启动,再检查端口的运行状态,即22端口是否开放,最后查看服务具体状态,如socket,service等。 解决方法: 1、安装openssl-server: sudo apt-get install 阅读全文
posted @ 2021-10-09 16:09 蜕变_hjr 阅读(1588) 评论(0) 推荐(0)
摘要: 在pycharm中,用shell运行导入fdfs_client客户端模块时出错:ModuleNotFoundError: No module named 'mutagen._compat'。 原因分析: File "D:\python_learn\meiduo_project\env\lib\sit 阅读全文
posted @ 2021-10-09 13:19 蜕变_hjr 阅读(544) 评论(1) 推荐(0)