上一页 1 2 3 4 5 6 7 8 ··· 17 下一页
摘要: 注意插入数字也是%s 阅读全文
posted @ 2019-03-07 21:09 Adamanter 阅读(3593) 评论(0) 推荐(0) 编辑
摘要: from mongoengine.connection import get_db, connect from pymongo import MongoClient, ASCENDING, UpdateOne, InsertOne, DeleteOne, ReplaceOne from pymongo.errors import BulkWriteError # pymongo建立索引... 阅读全文
posted @ 2019-03-07 20:50 Adamanter 阅读(4451) 评论(0) 推荐(0) 编辑
摘要: from datetime import datetime, timedelta 阅读全文
posted @ 2019-02-26 15:02 Adamanter 阅读(585) 评论(0) 推荐(0) 编辑
摘要: # coding=utf-8 # /usr/bin/python3.6 generate_stars.py # 定时任务每天凌晨第一分 # 1 0 * * * /usr/bin/python3.6 /root/backend/services/app/app/generate_stars.py # 测试定时任务1分一次 # */1 * * * * /usr/bin/python3.6 /roo... 阅读全文
posted @ 2019-02-22 09:59 Adamanter 阅读(1538) 评论(1) 推荐(0) 编辑
摘要: 一主两从一仲裁副本集模式是比较完善的数据库优化方案,和crontab定时shell脚本热备数据就更切合 为什么要仲裁节点:假如主从投票对决有可能公平撕逼,永远无法落实到底是谁,因此加入对主从加入仲裁节点,最简单的是主从仲裁各一个节点 一 基本部署 docker-compose.yaml 文件==》执 阅读全文
posted @ 2019-01-16 17:13 Adamanter 阅读(419) 评论(0) 推荐(0) 编辑
摘要: 1 app.py 2 models.py 3 views.py 4 sqlalchemy的外键建立 基本结构(看models.py): 如何建立外键关联: 对用户进行分类,用户要关联分类表,用户表要建立关于分类的关联,被关联的分类表什么都不用做: category_id = db.Column(db 阅读全文
posted @ 2019-01-11 17:50 Adamanter 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 1 手动备份 mongo3.0手动备份命令:mongodump -h localhost:27017 --authenticationDatabase "admin" -o /data/backup/dump/2019_01_09 mongorestore -h localhost:27017 /d 阅读全文
posted @ 2019-01-11 10:49 Adamanter 阅读(2127) 评论(0) 推荐(0) 编辑
摘要: 网络上mongorestore都写成mongorerstore抄袭成性 1 备份(mongodump) 该命令能够导出全部数据到指定文件夹中。-h:指明数据库宿主机的IP -u:指明数据库的用户名 -p:指明数据库的密码 -d:指明数据库的名字 -c:指明collection的名字 -o:指明到要导 阅读全文
posted @ 2019-01-10 20:31 Adamanter 阅读(1402) 评论(0) 推荐(0) 编辑
摘要: import shutil import os # UPLOAD_PATH = "/data/www/static/uploads" if os.path.exists(UPLOAD_PATH): for i in os.listdir(UPLOAD_PATH): path_file = os.path.join(UPLOAD_PATH... 阅读全文
posted @ 2018-12-29 17:33 Adamanter 阅读(777) 评论(0) 推荐(0) 编辑
摘要: 假设: ssh root@xx.xxx.xxx.x password: xxxxxxxxx 开了 80 81 8080 8088 端口 (1)进入数据文件所在目录:cd /data/www/db 将数据文件拷贝到home: cp db.sqlite3 /home (2)将sqlite3数据导出到du 阅读全文
posted @ 2018-12-29 16:54 Adamanter 阅读(3725) 评论(0) 推荐(0) 编辑
摘要: ubuntu终端中文显示问号或乱码或者存储汉字名文件显示问号解决办法: 1 sudo locale-gen zh_CN.UTF-8 root@iZ2zegomezxwu9ez7u5zm4Z:/datanew/static/uploads# sudo locale-gen zh_CN.UTF-8Gen 阅读全文
posted @ 2018-12-29 15:25 Adamanter 阅读(1830) 评论(0) 推荐(0) 编辑
摘要: 1 最简分页 使用mongoengine0.15.3,flask1.0.2, python3.6 阅读全文
posted @ 2018-12-28 10:40 Adamanter 阅读(114) 评论(0) 推荐(0) 编辑
摘要: uploads and downloads uploads python:3.6 flask:1.0.2 downloads python:3.6 flask:1.0.2 阅读全文
posted @ 2018-12-27 11:44 Adamanter 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 1 mysql 导出数据 导出需求以及mysql导出数据代码: 2 mongodb 导出数据 模块:pymongo 3.7.0 以及pymongo脚本导出代码 1 # 正常下载数据文件 2 # filename="哈喽.json" 3 # dir = os.path.dirname(os.path. 阅读全文
posted @ 2018-12-26 16:48 Adamanter 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 建立mongodb索引某集合的索引: 一 脚本方式, 通过pymongo方式 version:pymongo 3.7 连接本地mongodb的annosys数据库的image集合,为image建立索引 假如代码位于docker容器名web内部,mongodb又是容器名mongodb,需要连接两doc 阅读全文
posted @ 2018-12-21 10:53 Adamanter 阅读(893) 评论(0) 推荐(0) 编辑
摘要: 假设我的application name 为DjangoRESTImage; 假设我的数据库使用sqlite3; 删除数据库脚本:rm_db.sh python manage.py 启动 run_as_python.sh uwsgi 启动程序 run_as_server.sh 简单uwsgi脚本 u 阅读全文
posted @ 2018-11-15 12:17 Adamanter 阅读(930) 评论(0) 推荐(1) 编辑
摘要: 一、Linux的变量种类 按变量的生存周期来划分,Linux变量可分为两类:1. 永久的:需要修改配置文件,变量永久生效。2. 临时的:使用export命令行声明即可,变量在关闭shell时失效。 按照变量类型分: 内部变量:系统提供,不用定义,不能修改环境变量:系统提供,不用定义,可以修改,可以利 阅读全文
posted @ 2018-11-08 11:45 Adamanter 阅读(464) 评论(0) 推荐(0) 编辑
摘要: 1 whatever zhang 张无忌2 make the fox rush 令狐冲3 look crazy 瞧疯?乔峰4 hi baby 韦小宝5 let me go 任我行6 red seven male 洪七公7 dr.huang 黄药师8 fault young 杨过9 health yo 阅读全文
posted @ 2018-11-06 14:26 Adamanter 阅读(3933) 评论(0) 推荐(0) 编辑
摘要: __gt 大于 __gte 大于等于 __lt 小于 __lte 小于等于 __in 存在于一个list范围内 __startswith 以...开头 __istartswith 以...开头忽略大小写 __endswith 以...结尾 __iendswith 以...结尾,忽略大小写 __range 在...范围内 __year... 阅读全文
posted @ 2018-11-01 16:58 Adamanter 阅读(1586) 评论(0) 推荐(0) 编辑
摘要: 最常用的SQLAlchemy列类型 类型名Python类型说 明 Integer int 普通整数,一般是 32 位 SmallInteger int 取值范围小的整数,一般是 16 位 BigInteger int 或 long 不限制精度的整数 Float float 浮点数 Numeric d 阅读全文
posted @ 2018-10-19 10:40 Adamanter 阅读(777) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 17 下一页