PYTHON中分组groups
from itertools import groupby
def get_cm_months_report(start_date, end_date):
"""上一次Check out时间和最近一次Check in时间,并且相减。取所有小于等于365天的单据。
"""
csv_header = [
"Serial Number",
"Stock Code",
"Group"分类目录归档:Python-Dev
from itertools import groupby
def get_cm_months_report(start_date, end_date):
"""上一次Check out时间和最近一次Check in时间,并且相减。取所有小于等于365天的单据。
"""
csv_header = [
"Serial Number",
"Stock Code",
"Group"'''数据库配置'''
DATABASES = {
# 主(写)
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'blog',
'HOST': '42.193.152.252',
'PORT': 3306,
import datetime
import pendulum
# 把需要转换的时间字符串转为datetime对象,再转为字符串
now = datetime.datetime.strptime('2022-11-11 14:13:32', '%Y-%m-%d %H:%M:%S')
new_str = now.strftime('%Y-%m-%d %H:%M:%S')
# 把字符串转为pendulum时间对象
pt = pendulum.parse(new_str, tz='Asia/Shanghai')
pip install djangorestframework-simplejwt
INSTALLED_APPS = [
...
'rest_framework_simplejwt',
...
]
REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'rest_framework_simplejwt.authentication.JWTAuthentication',
)# 获取评论递归测试序列化器
class CommentSubsSerializers(serializers.ModelSerializer):
user = UserInfoSerializers(read_only=True)
ip_info = serializers.JSONField(source='get_ip_info', read_only=True)
child = serializers.Serializ配置vscode python解释器
ctrl + shift + p
输入Python: select intxxxxxx
把django源码文件复制到指定目录下
用vscode打开
创建调试器信息
创建调试器
ctrl + shift + d
创建成功后会在当前目录自动生成.vscode/launch.json文件
配置launch.json调试器配置
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descript官网 https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html
-------------- celery@DESKTOP-6RC5C0D v5.2.3 (dawn-chorus)
--- ***** -----
-- ******* ---- Windows-10-10.0.19044-SP0 2022-04-01 15:34:29
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app: mCELERY_BROKER_URL = 'amqp://chf:chenhaifeng@47.120.55.99:5672' CELERY_TASK_TRACK_STARTED = True CELERY_TASK_TIME_LIMIT = 30 * 60 CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
celery.py
ibash xxxx.deb
中途选择安装路径
su
cd
cat .bashrc
source .bashrc
复制conda init 内容到需要用到conda的用户那个 .bashrc文件
再执行source .bashrc更新即可
解决下载慢问题
# define an alias for the specific python version used in this file.
FROM python:3.11.3-slim-bullseye as python
# Python build stage
FROM python as python-build-stage
ARG BUILD_ENVIRONMENT=local
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.