摘要:
1. 数据库设置 import pymysql # 数据库连接配置 DB_HOST = '127.0.0.1' # ip DB_PORT = 3306 # 端口 DB_USER = 'root' # 用户名 DB_PASSWD = 'root' # 密码 DB_DATABASE = 'db_1' # 阅读全文
摘要:
data = [342.8, 337.96, 336.68, 337.94, 337.35, 340.4, 342.42, 341.86, 339.4, 341.76, 342.9, 343.63, 338.88, 339.43] # 风向角度区分 directions = { "北": [(348 阅读全文
摘要:
1. orm order_by 对字段进行排序, 按中文 models.EnterpriseInfo.objects.extra(select={'name_pinyin': "CONVERT(name USING GBK)"}).order_by('name_pinyin').values('id 阅读全文
摘要:
#### 坐标系转换 ```python """ 坐标转换工具类 xll >2021-05-19 developer """ import math import pandas as pd import numpy as np from pyproj import Proj, transform, 阅读全文
摘要:
#### 1. django-simple-captcha 下载 `pip install django-simple-captcha` #### 2. 配置 ##### 2.1 settings.py 配置 ```python # 注册 app INSTALLED_APPS = [ .... 'c 阅读全文
摘要:
#### admin.py 后台管理界面修改密码 ```python from django.contrib import admin from django.contrib.auth.hashers import make_password from django.http import Http 阅读全文
摘要:
#### 1. 取最大值, 最小值, 平均值 ```python df.max() df.iloc[:, 1:].max() df.min() df.mean() # 输出 index value ``` #### 2. 生成 空值, 带index的 series ```python pd.Seri 阅读全文
摘要:
```python from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def main(object_list, page_index, display_num=10): """ :param objec 阅读全文
摘要:
#### 1. GET请求 ```python # query请求 def get(self, request): print(request.GET) res = [] # 最终返回的结果集合 search_field = request.GET.get('search_field', '') p 阅读全文
摘要:
```python import hashlib def encrypt_password(password, salt): # 创建一个sha256的哈希对象 sha256_hash = hashlib.sha256() # 将盐值和密码组合起来并进行哈希 hashed_password = sa 阅读全文