摘要: from django.conf import settings print(settings.IP_LOCAL) 阅读全文
posted @ 2023-02-22 18:17 vx_guanchaoguo0 阅读(72) 评论(0) 推荐(0) 编辑
摘要: # coding=utf-8 import sys import os s = 'C:/Users/Desktop/lesson/python/calss1.py' m_dir = os.path.dirname(s) # 输出为 'C:/Users/Desktop/lesson/python' m 阅读全文
posted @ 2023-02-22 16:31 vx_guanchaoguo0 阅读(38) 评论(0) 推荐(0) 编辑
摘要: ####问题就是 关联类为空找不到 在或者geattr / hasattr / obj. item 会抛出异常 ####无法通过判断处理 捕获异常 try: tmp_data['demand_dept_name'] = data.demand_dept.name except Exception: 阅读全文
posted @ 2023-02-22 16:29 vx_guanchaoguo0 阅读(171) 评论(0) 推荐(0) 编辑
摘要: as_dict(self, keys=None, exclude_keys=None): """ 将ORM对象序列化为字典 :param keys: :return: """ if not keys: keys = self.output_fields keys += ['add_datetime' 阅读全文
posted @ 2023-02-22 10:20 vx_guanchaoguo0 阅读(116) 评论(0) 推荐(0) 编辑
摘要: import os from datetime import datetime, timedelta path = "." if __name__ == '__main__': for root, firs, files in os.walk(path): for file in files: if 阅读全文
posted @ 2023-02-22 10:01 vx_guanchaoguo0 阅读(54) 评论(0) 推荐(0) 编辑