随笔分类 - django
django
Django2.1集成xadmin管理后台所遇到的错误集锦,解决填坑
摘要:django默认是有一个admin的后台管理模块,但是丑,功能也不齐全,但是大神给我们已经集成好了xadmin后台,我们拿来用即可,但是呢,django已经升级到2.1版本了,xadmin貌似跟不上节奏,那么在集成过程中咱就一步一步填坑吧,这也是一种学习的过程,遇到错误,找到错误的地方,看看djan
阅读全文
python项目目录添加到python环境变量中
摘要:vim ~/.bash_profile 在.bash_profile中添加一下两行 PYTHONPATH=/mnt/udisk/project/myproject/wanwenyc export PYTHONPATH 修改完成执行以下命令生效 #source ~/.bash_profile
阅读全文
((1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1"))
摘要:参考网址:https://www.cnblogs.com/aidenzdly/p/11002506.html 原因:django2.1及其以后版本不再支持数据库5.5 解决办法是:更换了Django版本号,或者mysql版本号。 数据库换成8版本的即可
阅读全文
mysqlclient 1.4.0 or newer is required; you have 0.10.0
摘要:参考网址:https://www.cnblogs.com/meml/p/13579831.html 解决:在工程文件的__init__.py中加上 指定版本 import pymysqlpymysql.version_info = (1, 4, 13, "final", 0) #指定版本pymysq
阅读全文
drf使用开发接口
摘要:1.创建程序并初始化数据库: models.py中的内容: from django.db import models # Create your models here. class Category(models.Model): """ 文章分类 """ name = models.CharFie
阅读全文
resful规范
摘要:1.给一个url,例如:http://192.168.1.103:8000/info/ 发get请求:获取数据 发post请求:添加数据 发put请求:更新数据 发delete请求:删除数据 2.实现方式: FBV:根据不同url,做出不同的相应,例如get请求为一个url,post为另一个url等
阅读全文
ModuleNotFoundError: No module named 'corsheaders'解决办法
摘要:参考网址:https://blog.csdn.net/weixin_45336184/article/details/104185430 1. pip install django-cors-headers 2.如果已经安装,查看 django Server中运行的文件的Python interpr
阅读全文
No module named "Crypto",如何安装Python三方模块Crypto
摘要:参考网址:https://blog.csdn.net/u012798683/article/details/88654534 Python版本:Python3.6 ,操作系统:WIN10 首先用命令 pip install crypto 安装这个模块的时候 ,会安装后各种包,chardet, cer
阅读全文
python 安装虚拟环境
摘要:1. pip install virtualenv 2.pip install virtualenvwrapper-win 注: linux下运行pip install virtualenvwrapper
阅读全文
django 生成的数据库表 id 字段溢出问题解决方法
摘要:方法一:(不推荐) drop table_name; #删除表 django重新建表。 方法二: 1.查询当前自增字段的值 SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name="car_code"; 2.修改自增
阅读全文
xadmin列表页图片缩放(大图小图切换显示)
摘要:1.modes.py内容: 内容(html代码): html_img = """ <a href='{}'><span>{}<span></a><br/> <div onclick='$(".my_set_image_img").hide();$(this).next().show();'> <im
阅读全文
xadmin中添加Action类
摘要:1.在应用的adminx.py中代码如下: from xadmin.plugins.actions import BaseActionView #导入ActionView class MyAction(BaseActionView): #这里需要填写三个属性 action_name = "my_ac
阅读全文
xadmin的模块自动注册(注册版本)
摘要:1.settings中配置: 使用: 'xadmin', # 注册xadmin 'crispy_forms', # 注册xadmin的依赖应用crispy_forms 'reversion', #注册xadmin,模块版本控制(版本模块) INSTALLED_APPS = [ 'django.con
阅读全文
nginx内容清除
摘要:1.cd // 2.find / -name nginx* #查找所有关于nginx的文件 3.yum remove nginx* #删除nginx相关内容 nginx-filesystem.noarch 1:1.16.1-1.el7 will be erased Running transacti
阅读全文
Invalid template name in 'extends' tag: ''. Got this from the 'base_template' variable.
摘要:参考网址:https://blog.csdn.net/LisaYang94/article/details/86611612
阅读全文
django xadmin 导入功能添加
摘要:参考网址:https://www.cnblogs.com/yjlch1016/archive/2019/08/18/11373785.html https://www.cnblogs.com/yjlch1016/p/11373785.html 1.安装:pip install django-impo
阅读全文
python将excel读取的日期文本数字转为日期(5位数字时间戳)
摘要:1.安装pandas: pip install pandas 或 pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple 2.将“44042”转为“2020-07-30”脚本 a = "44042" import pandas a
阅读全文
django admin 增加查看权限
摘要:参考网址:https://blog.csdn.net/u011519550/article/details/100171861 django2.1以下是没有view权限的,所有可能有需要增加view权限的需求,最简单的方法,用现成的轮子django-admin-view-permission 直接三
阅读全文
centos7安装pycharm2018专业版及破解
摘要:链接:https://pan.baidu.com/s/12BlKabdqZeIqZq6juOlL4A 提取码:1234 1.下载pycharm-professional-2018.1.4.tar.gz包完成后,rz 上传到服务器 2.tar -xf pycharm-professional-2018
阅读全文