《Django 5 By Example》阅读笔记:p105-p164

《Django 5 By Example》读后感 本人的工作方向为Python Web方向,想了解下今年该方向有哪些新书出版,遂上packt出版社网站上看了看,发现这本书出版时间比较新(2024年9月),那就它了。从2024年11月11日至2024年12月18日期间,花了 22 天阅读完《Django 5 By Example》(《Django项目实例精解》)。 阅读详情

《Django 5 By Example》学习第5天,p105-p164总结,总计60页。

一、技术总结

1.文章标签功能

Django自带django-taggit。

2.自定义template tags

3.roadmap功能

4.RSS功能

5.full-text搜索功能

这里使用的是Postgresql,使用pip install psycopg安装后,执行“python manage.py migarte”会报ModuleNotFoundError: No module named 'psycopg2’错误。应该按照文档使用pip install "psycopg[binary,pool]"进行安装。

二、英语总结(生词:4)

1.agnostic

p147, Although Django is a database-agnostic web framework, it provides a module that supports part of the rich feature set offered by PostgreSQL, which is not offered by other databases that Django supports.

(1)agnostic: a-(“not”) + *gno-(“to know”)。adj. neutral.

2.stem

p156, Stemming is the process of reducing words to their word stem, base, or root form.

(1)stem: *sta-(“stand, be firm”).

adj. central structure of plant(植物的茎干)。这里是一种比喻意义的用法,意为“central part of sth/fundamental part of sth (词干提取)”。

3.boost

p159, We can boost specific vectors so that more weight is attributed to them when ordering results by relevancy.

vt. to increase or improve sth.

4.trigram

p160, Another search approach is trigram similarity.

n. anothe term for trigraph.

三、其它

chapter 03简评:本章介绍了一些常见的功能,但这些功能都是基于Django的admin去实现,不是很通用,本人选择快速过一遍,了解有哪些库及其用法,不做深入学习。

四、参考资料

1. 编程

(1) Antonio Melé,《Django 5 By Example》:https://book.douban.com/subject/37007362/

2. 英语

(1) Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org
在这里插入图片描述

欢迎搜索及关注:编程人(a_codists)

ESP32开发进阶:1.接入文心一言 ESP32开发进阶:接入文心一言大模型,串口对话 阅读详情

相关推荐

【AGC】【serverless】【云函数】云函数常见问题

1、云函数添加了AUTH触发器后,在用户执行注册、销户、登录、登出动作时,云函数的event对象会自动触发返回相应信息。比如我在“层”的压缩包里放了config/config.txt,那么我在云函数里怎么调用这个文件?层的目录是:/dcache/layer,函数的目录是/dcache/layer/func。在云函数里往云数据库里插入数据返回的是180000,这是正常吗?已经按照文档在后台对应的云函数里配置了,所需的AUTH触发器。层的用法和放在函数里的用法是相同的。云函数里的层如何调用?

华为开发者联盟 840

《Django 5 By Example》阅读笔记:p679-p765

书里通过聊天软件功能演示Django中channel以及异步编程的应用,本人对这块不是很熟悉,不做评价。(1)engage: en-(“in”) + gage(“a pledge, commitment, or security,保证,承诺”)。

codists的博客 1046

利用LTspice设计Pt100测温电路

是一种广泛使用的温度传感器,它属于(RTD, Resistance Temperature Detector)的类型,通常用于温度测量。在0°C时,的电阻值为100欧姆,且它的电阻值会随着温度的升高而升高。PT100热电阻温度阻值对应表)因此可以根据这一特性来检测出环境温度。

2301_77033628的博客 2418

《Django 5 By Example》阅读笔记:p237-p338

表之间的关系有三种:OneToOneField,many-to-one(使用Foreignkey()),ManyToManyField。

codists的博客 731

Xilinx PCIe IP核示例工程仿真流程与关键任务解析

本文详细解析了Xilinx PCIe IP核示例工程的仿真流程与关键任务。通过搭建仿真环境、解读初始化日志,并深入剖析TSK_TX_MEMORY_WRITE_32等核心任务的TLP报文生成与交互过程,帮助开发者掌握PCIe IP核的仿真调试方法,为实际硬件设计提供可靠的验证基础。

weixin_28314575的博客 510

华为Atlas200DK实战指南:从零搭建AI开发环境到人像语义分割模型部署

本文提供了一份详尽的华为Atlas 200DK AI开发环境搭建与模型部署实战指南。文章采用合设环境方案,从SD卡准备、系统镜像烧录、网络配置到必备工具安装,逐步引导开发者完成环境搭建。核心部分详细讲解了如何利用华为ATC工具将TensorFlow模型转换为昇腾专用格式,并最终成功编译和运行人像语义分割模型,实现实时人像识别效果。

weixin_29309213的博客 356

《Django 5 By Example》阅读笔记:p521-p542

django-parler 用于 model 的 translate。这里要注意下,使用 django-parler 之后会生成新的表,对原来的表数据有影响。本人未在实际项目中做过国际化开发,但个人觉得这种做法不好。vt. fit one thing to another(适应)。

codists的博客 854

Webpack打包到宝塔上线:前端小白也能搞定的部署保姆教程

本文为前端开发者提供了一份详尽的Webpack项目部署指南。通过宝塔面板的可视化操作,手把手教你如何将Vue3等项目从本地构建、打包,到上传服务器、配置Nginx,最终完成上线部署的全过程,有效解决了新手在项目上线环节的常见难题。

jjj34的博客 225

《Django 5 By Example》阅读笔记:p1-p16

《Django 5 By Example》学习第1天,p1-p16总结,总计16页。 (2)定义model (3)启动项目 二、英语总结(生词:8) 1.fintech abbreviation for financial technology: the business of using technology to offer financial services in new ways。He joined Backbase in 2023, following its acquisition of N

codists的博客 1000

Codesys入门-新建工程+任务调用+编译+调试

程序组织单元(Program Organization Unit, POU)由声明区和代码区组成,是用户程序的最小软件单元,它相当于传统编程系统中的块(Block),按功能程序组织单元(POU)可分为函数(FUN)、功能块(FB)、程序(PRG)。:Codesys采用多任务的方式来执行用户程序的“任务”,而每个“任务”分配了不同的执行周期,有些全局变量可能要在不同的POU之间被访问和修改,于是需要对全局变量进行交互同步,也是在任务的“时间对准点”进行的,实例:声明了INT类型,变量名为输入;

刺客 1万+

18、深入解析航空飞行数据中的秘密:从数据清理到高级分析

本文详细解析了如何使用R语言处理和分析航空飞行数据,从基础的数据清理到复杂的回归分析和机器学习模型构建。文章涵盖了探索性数据分析、天气数据的整合、地理信息可视化、时间序列预测以及航班延误的优化策略等内容,展示了如何通过数据挖掘技术提高航空运营效率和乘客满意度,并探讨了数据质量评估与隐私保护的重要性。

convnet3designer的博客 108

《Django 5 By Example》阅读笔记:p543-p550

Afixture。

codists的博客 1260

Linux内核编程(十三)Input输入子系统

Input 子系统是 Linux 内核中专门为输入设备设计的一个子系统,它提供了一个通用的框架来管理各种输入设备,如键盘、鼠标、触摸屏、游戏手柄等。这个子系统的主要目的是简化和规范化输入设备驱动的开发,同时提高驱动的通用性和兼容性。(1)输入设备:如键盘、鼠标、触摸屏、游戏手柄等,它们是用户与计算机进行交互的主要方式。(2)输入设备驱动的复杂性:传统上,为每种输入设备编写驱动都需要创建文件、进行硬件初始化、实现文件操作函数集和处理中断等。每种设备的驱动可能都有许多重复性的工作。

qq_1033275663的博客 2867

《Django 5 By Example》阅读笔记:p17-p53

数据库迁移c. one side of a multi-sided object.本意多面物体(例如钻石)的某一面,在这里表示“a specific aspect of information”或者“a specific dimension of information”.

codists的博客 1076

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

《Django 5 By Example》阅读笔记:p339-p358

vt. to persuade sb forcefully to do sth(强制)。

codists的博客 1312

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

《Django 5 By Example》阅读笔记:p645-p650

Serializer又细分为Serializer, ModelSerializer, HyperlinkedModelSerializer.c. a piece of thick paper, leather or plastic that you put betweent the pages of a book so that you can find a page again quickly(书签).

codists的博客 939

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

《Django 5 By Example》阅读笔记:p493-p520

以前总觉得这两个缩写好难记,今天仔细看了下维基百科,“i18n” 中的 i 代表 “internationalization” 的第一个字母 i,n 代表最后一个字母 n, 18 代表 i 和 n 中间有 18 个字母。“L10n” 中的 i 代表 “localization” 的第一个字母 l,n 代表最后一个字母 n, 10 代表 l 和 n 中间有 10个字母。使用大写L 是因为小写的 l(L的小写) 和 大写的 I(i 的 大写)差不多一样,所以使用大写,其实大小写都可以。

codists的博客 1062

《Django 5 By Example》阅读笔记:p651-p678

(1)aggregate:ad-(“to”) + gregare(“to collection into a flock(群), to gather”)因为ad 后面跟的是gregate,为了发音方便,ad演变为了ag。aggregate的本意是:vt. to combine into a single group(聚合, multiple things > single group)。示例:The butterflies aggregate in dense groups(蝴蝶聚集在一起).

codists的博客 988

《Django 5 By Example》阅读笔记:p614-p644

Django自带的缓存有:since accessing memory is faster than accessing data from databases of files(为了获得最佳性能,请使用基于内存的缓存后端,如Memcached或Redis,因为访问内存比从数据库或文件访问数据要快)其实我很想知道既然 Memcached 和 Redis 都是基于内存,那么该怎么选择呢?

codists的博客 691

《Django 5 By Example》阅读笔记:p211-p236

adv. without any interruption(连续地).

codists的博客 1158

《Django 5 By Example》阅读笔记:p388-p454

我觉得书中这种用法太简单了。adj. happening regularly(定期的)。

codists的博客 998

《Django 5 By Example》阅读笔记:p561-p613

(1)定义(什么是 mixins?(2)适用场景(为什么使用?vt. to keep safe, preserve from loss or decay(保护,节省)。p607, caching helps conserve computing power and reduces the need to query the database each time students access the same materials(缓存有助于节省计算能力,并减少学生每次访问相同材料时查询数据库的需要)。

codists的博客 676

《Django 5 By Example》阅读笔记:p165-p210

(1)登录认证作者这里使用的是Django自带的auth。(2)上传头像图片处理,使用Pillow。(3)扩展user扩展user模型与自带的user使用外键进行关联,命名为profile。p202, Pillow is the de facto standard library for image processing in Python. de facto不完全等于in fact, 可以理解为虽然不是法律上或者标准上,但在实际中被认为是。

codists的博客 761

《Django 5 By Example》阅读笔记:p54-p75

(1)分页:Paginator(2)页数不存在处理: EmptyPage, PageNotAnInteger(1)canon。

codists的博客 768

《Django 5 By Example》阅读笔记:p455-p492

(1)打折功能使用折扣码实现,但是折扣码是手动生成的,感觉实际业务中应该不是这样的。(2)推荐功能使用 Redis 做缓存,结合商品的销量做推荐,算是一种普通的实现方案。c. a piece of paper that can be used to buy sth at a reduced price(优惠券)。

codists的博客 739

《Django 5 By Example》阅读笔记:p551-p560

(1)示例try:query = {value = 0else:return f'

codists的博客 535
上一篇: 《Django 5 By Example》阅读笔记:p76-p104
下一篇: 《Django 5 By Example》阅读笔记:p165-p210
codists
博客等级 码龄6年 1488粉丝 379原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值