摘要:
django model https://docs.djangoproject.com/en/3.2/topics/db/models/ django的ORM工具, 具有非常简洁的接口,遵从django快速开发的理念。 但是此工具是跟django深度绑定的, 很难独立使用。 A model is t
阅读全文
posted @ 2021-11-22 00:16
lightsong
阅读(251)
推荐(0)
摘要:
Are locks unnecessary in multi-threaded Python code because of the GIL? https://stackoverflow.com/questions/105095/are-locks-unnecessary-in-multi-thre
阅读全文
posted @ 2021-11-14 18:28
lightsong
阅读(250)
推荐(0)
摘要:
Marking extra actions for routing https://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing ModelViewSet集成了 CRUD 所有功
阅读全文
posted @ 2021-11-13 22:51
lightsong
阅读(78)
推荐(0)
摘要:
lerna https://lerna.js.org/ https://github.com/lerna/lerna 对于规模大的项目, 使用单独一个库管理, 但是内部分为多个package的情况; 使用此工具管理。 Splitting up large codebases into separat
阅读全文
posted @ 2021-11-12 14:18
lightsong
阅读(89)
推荐(0)
摘要:
django migration https://docs.djangoproject.com/en/3.2/topics/migrations/ Migrations are Django’s way of propagating changes you make to your models (
阅读全文
posted @ 2021-11-09 12:32
lightsong
阅读(168)
推荐(0)
摘要:
react-sketch https://github.com/tbolis/react-sketch Sketch Tool for React-based applications, backed up by FabricJS tbolis.github.io/showcase/react-sk
阅读全文
posted @ 2021-11-09 10:46
lightsong
阅读(186)
推荐(0)
摘要:
Shell IO https://tecadmin.net/prompt-user-input-in-linux-shell-script/# Take Input on Termianl Let’s begin with input directly on terminal. Open a ter
阅读全文
posted @ 2021-11-04 09:51
lightsong
阅读(603)
推荐(0)
摘要:
mapDispatchToProps of react-redux https://react-redux.js.org/using-react-redux/connect-mapdispatch Two Forms of mapDispatchToProps The mapDispatchToP
阅读全文
posted @ 2021-11-01 16:04
lightsong
阅读(46)
推荐(0)
摘要:
echo模型 https://channels.readthedocs.io/en/stable/tutorial/part_2.html 浏览器请求, channels给响应。 receive回调接受消息, send接口发送响应消息 # chat/consumers.py import json
阅读全文
posted @ 2021-11-01 00:04
lightsong
阅读(69)
推荐(0)
摘要:
react-router-dom https://github.com/remix-run/react-router/blob/main/docs/getting-started/tutorial.md 对于location的变化, 不论是 hashtag方式, 或者是 通过pushstate改变u
阅读全文
posted @ 2021-10-31 22:29
lightsong
阅读(992)
推荐(0)
摘要:
User authentication in Django https://docs.djangoproject.com/en/3.2/topics/auth/ django带有一个用户认证系统,能够处理 用户账户、组、许可、基于cookie的用户会话。 Django comes with a us
阅读全文
posted @ 2021-10-31 18:14
lightsong
阅读(162)
推荐(0)
摘要:
background 基于django和react构建开发环境: django+restframework作为后台API提供者 react+ant design作为前端UI框架 利用django和react的开发工具的热更新功能, 实现前后台代码更新都不需要手动重启server。 如下拓扑图。 首先
阅读全文
posted @ 2021-10-31 09:55
lightsong
阅读(59)
推荐(0)
摘要:
type annotations https://docs.python.org/3.6/library/typing.html 为类类型提示(IDE or 人类可读)设计, 又叫类型注解。 typing — Support for type hints This module supports t
阅读全文
posted @ 2021-10-26 14:59
lightsong
阅读(88)
推荐(0)
摘要:
Draw and Guess Game https://github.com/fanqingsong/draw_guess draw and guess based on django_channels_chat_official_tutorial_react project, create dra
阅读全文
posted @ 2021-10-24 11:23
lightsong
阅读(87)
推荐(0)
摘要:
Invoke https://docs.pyinvoke.org/en/stable/ The invoke CLI tool Details on the CLI interface to Invoke, available core flags, and tab completion optio
阅读全文
posted @ 2021-10-21 15:26
lightsong
阅读(49)
推荐(0)
摘要:
Django Channels Django 仅仅支持 HTTP协议, Channels 扩展了支持的协议类型, 例如 websocket,chat, IoT. 本身实现基于ASGI协议。 但是你也可以选择 同步模式。 https://channels.readthedocs.io/en/stabl
阅读全文
posted @ 2021-10-20 17:28
lightsong
阅读(95)
推荐(0)
摘要:
OverView Django View -- Root https://docs.djangoproject.com/en/3.2/ref/class-based-views/base/#view 所有view视图的基类, 此类不是通用视图,被业务视图继承。 class django.views.
阅读全文
posted @ 2021-10-17 23:40
lightsong
阅读(78)
推荐(0)
摘要:
ViewSets & Routers https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/ ViewSets是对模型的高度抽象, 让开发者聚焦于建模状态, 和 接口的交互, 基于通用的规则构建URL. REST
阅读全文
posted @ 2021-10-13 00:08
lightsong
阅读(76)
推荐(0)
摘要:
Relationships & Hyperlinked APIs https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/ 对于表之间的关联关系, ModelSerializer 默认是使
阅读全文
posted @ 2021-10-12 23:39
lightsong
阅读(87)
推荐(0)
摘要:
Authentication & Permissions https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/ 对于view需要限制用户的访问权限, 例如认证 和 许可。 Currently
阅读全文
posted @ 2021-10-12 23:21
lightsong
阅读(94)
推荐(0)
摘要:
Class-based Views https://www.django-rest-framework.org/tutorial/3-class-based-views/ APIView 继承于 django view类提供了 http method 方法的抽象, 即继承于此类的应用类中, 可以定义
阅读全文
posted @ 2021-10-12 22:30
lightsong
阅读(80)
推荐(0)
摘要:
Requests and Responses https://www.django-rest-framework.org/tutorial/2-requests-and-responses/ Request 请求类,扩展了 httprequest类。 请求数据存储在 request.data 成员中
阅读全文
posted @ 2021-10-12 15:18
lightsong
阅读(61)
推荐(0)
摘要:
Django REST framework Django 支持MTV模式, 前端渲染的内容,放在了后端 template中实施,包括获取数据,渲染模板一系列过程都在候选执行。 在前端能力强大的现在, 前后端分离开发模式已经成为主流, 所以后端只提供API, 于前端进行数据交互,成为业界主流。 此框架
阅读全文
posted @ 2021-10-12 15:06
lightsong
阅读(65)
推荐(0)
摘要:
Metaclasses https://www.python.org/dev/peps/pep-3115/ 元类的诞生是来自于大量有趣的用例, 要求在类创建的过程中,就可以参与到类的定制逻辑中去。 The primary reason for changing the way metaclasses
阅读全文
posted @ 2021-10-10 23:50
lightsong
阅读(48)
推荐(0)
摘要:
https://docs.djangoproject.com/en/3.2/misc/design-philosophies/#cache-design-philosophy Loose coupling 低耦合 高内聚-低耦合是其设计目标。 不同的层不需要知道其它层, 除非是绝对必要。 例如: 模
阅读全文
posted @ 2021-10-01 22:49
lightsong
阅读(65)
推荐(0)
摘要:
Architecture 实现前后端分离架构: 网页静态资源, 由nginx直接响应。 DJANGO脚本资源的请求, 由uWSGI服务器处理。 https://decovar.dev/blog/2019/11/03/nginx-uwsgi-python-scripts/#nginx-server-c
阅读全文
posted @ 2021-09-26 00:42
lightsong
阅读(124)
推荐(0)
摘要:
master-worker模式 https://blog.csdn.net/u012845099/article/details/78463324 Master-Worker模式是常用的并行模式之一,它的核心思想是,系统有两个进程协作工作:Master进程,负责接收和分配任务;Worker进程,负责
阅读全文
posted @ 2021-09-24 11:23
lightsong
阅读(464)
推荐(0)
摘要:
Supervisor 是一个CS架构的软件系统, 支持用户监控和控制大量的进程, 具有跨系统性, 在所有的类UNIX系统上。 不是对系统驻守进程管理器的代替, 它的目的是用用控制一个项目或者用户相关的进程。 此进程在系统初始化时候启动。 http://supervisord.org/index.ht
阅读全文
posted @ 2021-09-22 16:23
lightsong
阅读(109)
推荐(0)
摘要:
Buffon's Needle https://mste.illinois.edu/activity/buffon/ 介绍 + 模拟 Buffon's Needle is one of the oldest problems in the field of geometrical probabili
阅读全文
posted @ 2021-08-12 00:47
lightsong
阅读(312)
推荐(0)
摘要:
dest https://docs.python.org/3/library/argparse.html#dest dest用于指定解析后将参数值,存储到参数表中的参数名称, 简称存储参数名。 dest本身是add_argument参数之一 The name of this attribute is
阅读全文
posted @ 2021-08-09 22:04
lightsong
阅读(131)
推荐(0)
摘要:
Integration with FastAPI and APScheduler https://www.cnblogs.com/lightsong/p/15054120.html 上篇博文,介绍了如何给 API Server添加 APScheduler, 以便之后后台的定时任务。 但是这里有一个问
阅读全文
posted @ 2021-08-08 00:23
lightsong
阅读(609)
推荐(0)
摘要:
Getting Started With Async Features in Python https://realpython.com/python-async-features/#:~:text=%20Using%20Python%20Async%20Features%20in%20Practi
阅读全文
posted @ 2021-08-07 21:58
lightsong
阅读(76)
推荐(0)
摘要:
Background 大部分的框架,要么只支持 restful API, 要么只支持CLI。 例如: fastapi 或者 django_rest_framework 支持rest API click 支持将函数装饰为 CLI 特殊情况,需要两种都要支持。即一份代码, 同时支持两种接口。 hug就是
阅读全文
posted @ 2021-08-03 23:56
lightsong
阅读(178)
推荐(0)
摘要:
supplychain on blockchain 每个公司都有自己的供应链, 过程中产生的交易数据, 如果存在其中参与方的一方服务器中, 并不能像银行的一样, 能够给各方产生一个信任的效果,因为任何一方都会担心数据的拥有这改变数据。 区块链天生具有不可篡改, 去中心化的特性, 可以解决供应链中各个
阅读全文
posted @ 2021-08-03 17:59
lightsong
阅读(95)
推荐(0)
摘要:
xstate https://xstate.js.org/docs/ https://github.com/statelyai/xstate 为现代的web提供有限状态机功能。 JavaScript and TypeScript finite state machines (opens new wi
阅读全文
posted @ 2021-08-02 23:09
lightsong
阅读(451)
推荐(0)
摘要:
PI https://www.mathsisfun.com/numbers/pi.html Draw a circle with a diameter (all the way across the circle) of 1 Then the circumference (all the way a
阅读全文
posted @ 2021-08-01 22:14
lightsong
阅读(1392)
推荐(0)
摘要:
Gunicorn https://docs.gunicorn.org/en/latest/index.html https://github.com/benoitc/gunicorn Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP Server for
阅读全文
posted @ 2021-07-25 00:26
lightsong
阅读(259)
推荐(0)
摘要:
AIOHTTP https://docs.aiohttp.org/en/stable/ 异步HTTP客户端和服务器,为asyncio 设计。 因为 作为客户端的 requests 支持同步请求模式, 一个请求完成后,才能执行下一个请求。 Asynchronous HTTP Client/Server
阅读全文
posted @ 2021-07-24 17:45
lightsong
阅读(195)
推荐(0)
摘要:
API Server with Scheduler 一般API服务器,仅仅提供API接口, 执行单次业务逻辑的执行。 如果在API服务器后台,执行定时执行功能, 让后台承担业务逻辑的定时执行功能, 添加APScheduler库。 FastAPI https://fastapi.tiangolo.co
阅读全文
posted @ 2021-07-23 22:55
lightsong
阅读(1341)
推荐(0)
摘要:
APScheduler https://github.com/agronholm/apscheduler 高级的python sheduler Advanced Python Scheduler (APScheduler) is a Python library that lets you sche
阅读全文
posted @ 2021-07-21 17:04
lightsong
阅读(150)
推荐(0)