摘要: 1、re_path和path的作用是一样的。只不过're_path'是在写url的时候可以用正则表达式,功能更加强大。2、写正则表达式都推荐使用原生字符串。也就是以‘r’开头的字符串:r'move/'3、在正则表达式中定义变量,需要使用圆括号括起来。这个参数是有名字的,那么需要使用'?P<参数的名字 阅读全文
posted @ 2019-12-22 18:00 xsan 阅读(3584) 评论(6) 推荐(0) 编辑
摘要: url是Uniform Resource Locator的简写,统一资源定位符。 scheme://host:port/path/?query-string=xxx#anchor1、scheme:代表的是访问的协议。一般为http或者https以及ftp等。2、host:主机名,域名,比如:www. 阅读全文
posted @ 2019-12-20 21:24 xsan 阅读(765) 评论(0) 推荐(0) 编辑
摘要: django中使用content_type表进行存储app与model的关系。在permission表中设立了name(权限的名字,中英文均可)content_type_id(与content_type是外键关系,用于绑定model)codename(在写代码时使用的权限名)那么如何自定义权限呢? 阅读全文
posted @ 2019-12-20 20:47 xsan 阅读(4493) 评论(0) 推荐(0) 编辑
摘要: 项目搬迁的时候,需要把当前的环境依赖包导出,然后到部署项目的服务器上安装依赖。 我们可以通过下面的命令执行,把依赖包导出到requirements.txt文件里。 生成requirements.txt pip freeze > requirements.txt 安装requirements.txt依 阅读全文
posted @ 2019-12-19 09:23 xsan 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 从官网上下载安装包:https://www.python.org/downloads/source/ 找到对应想要安装的版本进行下载。 1、 解压:tar -xvJf Python-3.7.5.tar.xz 2、 进入刚才的目录:cd Python-3.7.5 3、 配置:./configure - 阅读全文
posted @ 2019-12-18 20:41 xsan 阅读(273) 评论(0) 推荐(0) 编辑
摘要: pip国内的一些镜像 原始地址:https://pypi.python.org/simple 国内地址: 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(dou 阅读全文
posted @ 2019-12-11 22:01 xsan 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 使用yum命令报错 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax 问题出现原因:yum包管理是使用python2.x写的,将python2.x升级到python3.x以后 阅读全文
posted @ 2019-12-10 13:37 xsan 阅读(1498) 评论(0) 推荐(0) 编辑
摘要: 打开:https://www.netsarang.com/zh/free-for-home-school/ 然后填写自己的姓名与真实的邮箱即可。提交成功后,会将下载链接发送至刚才填写的邮箱里,发送的下载链接具有一定的时效。 阅读全文
posted @ 2019-12-07 17:55 xsan 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 报错: 分析 nginx和uwsgi整合时有三个参数可以用于设置超时时间: 1.uwsgi_connect_timeout: 默认60秒,与uwsgi-server连接的超时时间,该值不能超过75秒.若在超时时间内未能成功连接则断开连接尝试 2.uwsgi_read_timeout: 默认60秒,n 阅读全文
posted @ 2019-11-20 17:29 xsan 阅读(877) 评论(0) 推荐(0) 编辑
摘要: 在app文件夹下创建database_operations.py文件,写如下内容: import pymysql from 项目名.settings import DATABASES class Database_operat(object): def __init__(self, database 阅读全文
posted @ 2019-11-04 14:56 xsan 阅读(1106) 评论(0) 推荐(0) 编辑
摘要: 选款批次: 类目: 查询结果 阅读全文
posted @ 2019-08-13 21:53 xsan 阅读(3723) 评论(0) 推荐(0) 编辑
摘要: 在django中使用pandas操作django的ORM查询出来的QuerySet对象,可以使用插件django-pandas。 截止教程书写时间,django-pandas已发布到0.6.1。 依赖:django>=1.4.5 Django-model-utils >=1.4.0 Pandas > 阅读全文
posted @ 2019-08-12 22:37 xsan 阅读(8728) 评论(0) 推荐(0) 编辑
摘要: 序号 类目 关键词 操作 {% f... 阅读全文
posted @ 2019-07-11 18:15 xsan 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 1 import pandas as pd 2 import numpy as np 3 4 # merge合并 ,类似于Excel中的vlookup 5 6 df1 = pd.DataFrame({'key': ['K0', 'K1', 'K2', 'K3'], 7 'A': ['A0', 'A1 阅读全文
posted @ 2019-05-05 21:50 xsan 阅读(3155) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 Title 6 16 17 18 版本号: 19 20 阅读全文
posted @ 2019-05-03 09:28 xsan 阅读(703) 评论(1) 推荐(1) 编辑
摘要: 1 import pandas as pd 2 import numpy as np 3 4 s = pd.Series(['A', 'b', 'c', 'bbhello', '123', np.nan, 'hj']) 5 df = pd.DataFrame({'key1': list('abcde 阅读全文
posted @ 2019-05-02 20:46 xsan 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 1 import pandas as pd 2 import numpy as np 3 4 df = pd.DataFrame({ 5 'key1': [4, 5, 3, np.nan, 2], 6 'key2': [1, 2, np.nan, 4, 5], 7 'key3': [1, 2, 3, 阅读全文
posted @ 2019-04-29 21:29 xsan 阅读(1914) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 使用循环的方式判断一个元素是否存在于一个数组中 3 * @param {Object} arr 数组 4 * @param {Object} value 元素值 5 */ 6 function isInArray(arr,value){ 7 for(var i = 0; i < arr.length; i++){ 8 if(va... 阅读全文
posted @ 2019-04-20 14:48 xsan 阅读(3266) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import numpy as np import names ''' 写在前面的话: 1、series与array类型的不同之处为series有索引,而另一个没有;series中的数据必须是一维的,而array类型不一定 2、可以把series看成一个定长的 阅读全文
posted @ 2019-01-18 20:30 xsan 阅读(9580) 评论(0) 推荐(0) 编辑
摘要: 1 import numpy as np 2 3 # 1、快速排序 4 ''' 5 1、np.sort(),不改变原先值的顺序,但是在运行时占内存 6 2、ndarry.sort(),改变原先值的顺序,不占用内存 7 ''' 8 # 不改变n1的顺序 9 n1 = np.array([2, 5, 8, 156, 4, 9, 3]) 10 n2 = np.sort(n1) 11... 阅读全文
posted @ 2019-01-16 20:37 xsan 阅读(1309) 评论(0) 推荐(0) 编辑