摘要: 1 <input type="date" id="date_info" placeholder="请输入时间"/> 2 3 ...... 4 5 <script> 6 $(document).ready(function () { 7 var time = new Date(); 8 var day 阅读全文
posted @ 2019-12-24 10:13 xsan 阅读(3101) 评论(0) 推荐(1)
摘要: 使用path或者re_path后,在url中都可以包含参数,而有时候想指定默认的参数,可以通过在urls.py中写两个url都指向同一个视图函数。一个带参数一个不带参数。同时,在视同函数的参数中设置默认值。这样,当匹配到不带参数的url时,就会使用默认值。实例代码: urls.py 1 from d 阅读全文
posted @ 2019-12-23 22:44 xsan 阅读(871) 评论(0) 推荐(0)
摘要: django内置的url转换器,包括有int、str、uuid等等。但是有时候他们不能满足我们的需求,因此就需要使用自定义url转换器。自定义url转换器的五步:1、定义一个类,直接继承自object就可以2、在类中定义一个属性regex,这个属性是用来限制url转换器规则的正则表达式。3、实现to 阅读全文
posted @ 2019-12-22 22:30 xsan 阅读(958) 评论(0) 推荐(0)
摘要: 1、如果在反转url的时候,需要添加参数,那么可以通过传递'kwargs'参数到'reverse'函数中。实例代码: urls.py from django.urls import path, re_path from app01 import views urlpatterns = [ path( 阅读全文
posted @ 2019-12-22 19:15 xsan 阅读(3882) 评论(0) 推荐(0)
摘要: 1、re_path和path的作用是一样的。只不过're_path'是在写url的时候可以用正则表达式,功能更加强大。2、写正则表达式都推荐使用原生字符串。也就是以‘r’开头的字符串:r'move/'3、在正则表达式中定义变量,需要使用圆括号括起来。这个参数是有名字的,那么需要使用'?P<参数的名字 阅读全文
posted @ 2019-12-22 18:00 xsan 阅读(3745) 评论(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 阅读(804) 评论(0) 推荐(0)
摘要: django中使用content_type表进行存储app与model的关系。在permission表中设立了name(权限的名字,中英文均可)content_type_id(与content_type是外键关系,用于绑定model)codename(在写代码时使用的权限名)那么如何自定义权限呢? 阅读全文
posted @ 2019-12-20 20:47 xsan 阅读(4593) 评论(0) 推荐(0)
摘要: 项目搬迁的时候,需要把当前的环境依赖包导出,然后到部署项目的服务器上安装依赖。 我们可以通过下面的命令执行,把依赖包导出到requirements.txt文件里。 生成requirements.txt pip freeze > requirements.txt 安装requirements.txt依 阅读全文
posted @ 2019-12-19 09:23 xsan 阅读(383) 评论(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 阅读(297) 评论(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 阅读(222) 评论(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 阅读(1666) 评论(0) 推荐(0)
摘要: 打开:https://www.netsarang.com/zh/free-for-home-school/ 然后填写自己的姓名与真实的邮箱即可。提交成功后,会将下载链接发送至刚才填写的邮箱里,发送的下载链接具有一定的时效。 阅读全文
posted @ 2019-12-07 17:55 xsan 阅读(286) 评论(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 阅读(932) 评论(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 阅读(1127) 评论(0) 推荐(0)
摘要: 选款批次: 类目: 查询结果 阅读全文
posted @ 2019-08-13 21:53 xsan 阅读(3733) 评论(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 阅读(9263) 评论(0) 推荐(0)
摘要: 序号 类目 关键词 操作 {% f... 阅读全文
posted @ 2019-07-11 18:15 xsan 阅读(934) 评论(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 阅读(3264) 评论(0) 推荐(0)
摘要: 1 2 3 4 5 Title 6 16 17 18 版本号: 19 20 阅读全文
posted @ 2019-05-03 09:28 xsan 阅读(716) 评论(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 阅读(524) 评论(0) 推荐(0)