随笔分类 -  python

django orm order_by 根据汉字首字母排序 [ORDER BY CONVERT(name USING gbk)ASC]查询
摘要:首先mysql sql语句查询公司名称首字母排序如下: SELECT * FROM `表名` ORDER BY CONVERT (company USING gbk) Desc; django框架用orm查询 models.Contacts.objects.all().order_by('CONVE 阅读全文
posted @ 2021-01-06 11:28 程序小院 阅读(3192) 评论(1) 推荐(1)
linux centos7 django uwsgi 部署
摘要:安装这里就不多说,直接配置问题及所遇到问题总结 django 项目 manage.py目录新建uwsgi.ini文件 uwsgi配置 [uwsgi] # 请求方式与端口号socket = 127.0.0.1:9000 # uwsgi直接访问用http,nginx访问用socket http= 127 阅读全文
posted @ 2020-11-27 14:17 程序小院 阅读(198) 评论(0) 推荐(0)
linux nginx uwsgi django
摘要:先讲下配置 nginx 方面 外网ip:8000端口 server { listen 8000; server_name 服务器外网ip; charset utf-8; client_max_body_size 75M; location / { include uwsgi_params; uwsg 阅读全文
posted @ 2020-08-20 15:05 程序小院 阅读(171) 评论(0) 推荐(0)
word类型考题带选项答案批量存入mysql数据库中
摘要:由于工作需要批量将word文档考题导入mysql中 题目如下(简单列举下PHP试题): 1.mysql_connect( )与@mysql_connect( )的区别是 A @mysql_connect( )不会忽略错误,将错误显示到客户端 B mysql_connect( )不会忽略错误,将错误显 阅读全文
posted @ 2019-01-05 17:21 程序小院 阅读(619) 评论(0) 推荐(0)
python3安装docx模块出现Import Error: No module named 'exceptions'
摘要:x首先 pip3 install docx 显示已经安装,但是 No module named 'exceptions' 网上查的资料命令行下载的docx安装包还没有完全兼容python3,第三方库应该还没更新,需要下载一个兼容的包进行安装: https://www.lfd.uci.edu/~goh 阅读全文
posted @ 2018-07-18 17:54 程序小院 阅读(8562) 评论(0) 推荐(0)
Python cv2库(人脸检测)
摘要:根据访问图片识别 # coding:utf-8 import sysimport math import cv2 # 待检测的图片路径 imagepath = r'l.png' face_cascade = cv2.CascadeClassifier(r'./haarcascade_frontalf 阅读全文
posted @ 2018-06-14 13:15 程序小院 阅读(2276) 评论(0) 推荐(0)
python \xc2\x8c50\xc3\转汉子
摘要:a = '\xe4\xb8\xad\xe5\x9b\xbd' aa = a.encode('raw_unicode_escape') print(aa) # 结果:b'\xe4\xb8\xad\xe5\x9b\xbd' aaa = aa.decode() print(aaa) #结果 中国 阅读全文
posted @ 2018-04-18 11:37 程序小院 阅读(347) 评论(0) 推荐(0)
python+ajaxFileUpload 无刷新上传文件
摘要:需要准备文件 http://pan.baidu.com/s/1bp4N3nL qqi0 html <script src="{% static 'js/jquery.js' %}"></script> <script src="{% static 'js/ajaxfileupload.js' %}" 阅读全文
posted @ 2017-11-14 22:52 程序小院 阅读(1291) 评论(0) 推荐(0)
python django 访问static静态文件
摘要:settings 文件配置: STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'),)PROJECT_ROOT = os.path.dirname(__file__) STATICFILES_DIR 阅读全文
posted @ 2017-11-08 16:02 程序小院 阅读(2246) 评论(0) 推荐(0)
facebook广告上传Invalid appsecret_proof provided in the API argument
摘要:Status: 400 Response: { "error": { "message": "Invalid appsecret_proof provided in the API argument", "code": 100, "type": "GraphMethodException", "fb 阅读全文
posted @ 2017-11-08 13:41 程序小院 阅读(1003) 评论(0) 推荐(0)
python 利用turtle库绘制七段数码管的方式,绘制当前事件(时分秒00:00:00)
摘要:# coding:utf-8# 绘制七段数码管,显示当前时间import timeimport turtle as tt # 绘制间隔def drawGap(): tt.penup() tt.fd(3) # 绘制单段数码管def drawLine(draw): drawGap() if(draw): 阅读全文
posted @ 2017-09-14 13:06 程序小院 阅读(1077) 评论(0) 推荐(0)
python 利用turtle库绘制五角星
摘要:# -*- coding: utf-8 –*-import turtleimport math def draw_polygon(aTurtle, size=50, n=3): for i in range(n): aTurtle.forward(size) aTurtle.left(360.0/n 阅读全文
posted @ 2017-09-14 13:05 程序小院 阅读(1014) 评论(0) 推荐(0)
pycharm搭建开发配置,远程调试,数据库配置,git配置等
摘要:1 开发环境搭建 1.1 简介 使用虚拟机作为代码运行环境,本地使用pycharm进行代码编辑,使用远程调试功能进行debug。 1.1 安装centos虚拟机环境: 1、操作系统: 2、网络配置: 1.2 本地环境安装git 1.3 pycharm配置git 4.点击pycharm菜单:Pycha 阅读全文
posted @ 2017-09-05 10:06 程序小院 阅读(2631) 评论(0) 推荐(0)
python两个字典合并,两个list合并
摘要:1.两个字典:a={'a':1,'b':2,'c':3} b= {'aa':11,'bb':22,'cc':33} 合并1:dict(a,**b) 操作如下: 合并2:dict(a.items()+b.items()) 如下: 合并3:c = {} c.update(a) c.update(b) 输 阅读全文
posted @ 2017-07-27 09:39 程序小院 阅读(100302) 评论(0) 推荐(6)
python settings :RROR 1130: Host 'XXXXXX' is not allowed to connect to this MySQL server
摘要:pymysql.err.InternalError: (1130, u"Host '127.0.0.1' is not allowed to connect to this MySQL server") mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' 阅读全文
posted @ 2017-05-15 16:43 程序小院 阅读(418) 评论(0) 推荐(0)
django自定义标签,int转化为str类型
摘要:1.在app中创建templatetags目录,目录名必须为templatetags 2.在目录templatetags中创建一个.py文件,例如 strFilter.py strFilter.py #强制转换成str from django import template register = t 阅读全文
posted @ 2017-04-28 14:38 程序小院 阅读(1236) 评论(0) 推荐(0)