12 2022 档案
摘要:默认安装了python3 一. 安装Python2.7 1.安装 apt install python2 update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 update-alternatives --i
阅读全文
摘要:nmap简单使用 apt install nmap 从控制台发出的以下命令确定哪些端口正在侦听来自网络的TCP连接: nmap -sT -p- 10.10.8.8 -sT 告诉 nmap 扫描 TCP 端口。 -p- 扫描所有65535端口。 要扫描UDP端口,请使用-uT而不是-sT: nmap
阅读全文
摘要:一. 使用IP apiVersion: v1 kind: Service metadata: name: nginx-ip spec: ports: - protocol: TCP port: 88 apiVersion: v1 kind: Endpoints metadata: name: ngi
阅读全文
摘要:from datetime import datetime, timedelta push_time = '2022-03-23T08:40:10.895Z' push_time1 = datetime.strptime(push_time[0:-5], "%Y-%m-%dT%H:%M:%S") +
阅读全文
摘要:一.基本安装和配置 1.pip install django-pure-pagination 2. settings.py中 install app中添加'pure_pagination', 3. settings.py中添加参数 PAGINATION_SETTINGS = { 'PAGE_RANG
阅读全文
摘要:比如在model中定义了choice字段online online_choice = (('1', '在线'), ('0', '离线')) online = models.CharField(max_length=10, choices=online_choice) 在template中应该怎么显示
阅读全文
摘要:####一. 基本区别 aggregate:返回使用聚合函数后的字段和值。 annotate:在原来模型字段的基础之上添加一个使用了聚合函数的字段 ####二. 使用方法 class Book(models.Model): """图书模型""" name = models.CharField(max
阅读全文
摘要:django2.2代码出错时的页面排查 django2.2 安装后,使用runserver进行开发,出错时错误信息只显示于控制台命令行,而在前端页面只显示一行 “A server error occurred. Please contact the administrator.” 排错很不方便,仔细
阅读全文
摘要:django模板路径默认设置 在项目的同名文件夹下找到settings.py中settings.py中默认参数如下 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'A
阅读全文
摘要:目标:列出所有机构库中device表里的字段信息 一. 使用pymongo 1.列出所有机构的库, 格式为636B51BE22D2180001000B22_db import pymongo import re client = pymongo.MongoClient(host='10.30.110
阅读全文