楼主: 充实每一天
7448 90

20180427【充实计划】第690期   [推广有奖]

41
忘星 在职认证  发表于 2018-4-27 09:24:45
昨日阅读0.5小时,累计阅读29小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

42
kaixin1201 发表于 2018-4-27 09:24:59 来自手机
充实每一天 发表于 2018-4-27 05:55
【加入充实计划】【了解充实计划】

|新充实挑战|    |公告【想成为牛人】|
昨日阅读1小时,累积阅读6小时。
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

43
jeffyangsir 在职认证  发表于 2018-4-27 09:46:34
昨日阅读2小时,累计阅读66小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

44
byjsz725 发表于 2018-4-27 09:47:30 来自手机
昨日阅读0小时,累计7小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

45
GKINGLIU 在职认证  发表于 2018-4-27 09:55:03
DAY #27

1.主题
Flask Web Development.pdf
原作者视频讲解
https://www.bilibili.com/video/av5708093/?p=9

2.摘要
一个application的三部分:
第一部分:Initialization
All Flask applications must create an application instance. The web server passes all requests it receives from clients to this object for handling, using a protocol called Web Server Gateway Interface (WSGI). The application instance is an object of class Flask, usually created as follows:

from flask import Flask
app = Flask(__name__)

第二部分:Routes and View Functions
Clients such as web browsers send requests to the web server, which in turn sends them to the Flask application instance. The application instance needs to know what code needs to run for each URL requested, so it keeps a mapping of URLs to Python functions. The association between a URL and the function that handles it is called a route.
The most convenient way to define a route in a Flask application is through the app.route decorator exposed by the application instance, which registers the decorated function as a route. The following example shows how a route is declared using this decorator:

@app.route('/')
def index():
        return '<h1>Hello World!</h1>'

Flask supports these types of URLs using a special syntax in the route decorator.
@app.route('/user/<name>') def user(name):
return '<h1>Hello, %s!</h1>' % name

The portion enclosed in angle brackets is the dynamic part, so any URLs that match the static portions will be mapped to this route. When the view function is invoked, Flask sends the dynamic component as an argument. In the earlier example view function, this argument is used to generate a personalized greeting as a response.

第三部分:Server Startup
The application instance has a run method that launches Flask’s integrated development web server:

if __name__ == '__main__':
        app.run(debug=True)

During development, it is convenient to enable debug mode, which among other things activates the debugger and the reloader. This is done by passing the argument debug set to True.

逻辑总结:
The Request-Response Cycle  = Initialization  +  Routes and View Functions  +  Server Startup

Contexts enable Flask to make certain variables globally accessible to a thread without interfering with the other threads.
There are two contexts in Flask: the application context and the request context.
If any of these variables are accessed without an active application or request context, an error is generated.

Flask attaches methods to each route so that different request methods sent to the same URL can be handled by different view functions.

In most cases the response is a simple string that is sent back to the client as an HTML page.
A template is a file that contains the text of a response, with placeholder variables for the dynamic parts that will be known only in the context of a request. The process that replaces the variables with actual values and returns a final response string is called rendering. For the task of rendering templates, Flask uses a powerful template engine called Jinja2.

In its simplest form, a Jinja2 template is a file that contains the text of a response.

Bootstrap is a client-side framework, so the server is not directly involved with it. All the server needs to do is provide HTML responses that reference Bootstrap’s cascading style sheets (CSS) and JavaScript files and instantiate the desired components through HTML, CSS, and JavaScript code. The ideal place to do all this is in templates.

A redirect is a special type of response that has a URL instead of a string with HTML code. When the browser receives this response, it issues a GET request for the redirect URL, and that is the page that is displayed. This trick is known as the Post/ Redirect/Get pattern.

In the context of an ORM, a model is typically a Python class with attributes that match the columns of a corresponding database table.

Project Structure
This structure has four top-level folders:
* The Flask application lives inside a package generically named app.
* The migrations folder contains the database migration scripts, as before.
* Unit tests are written in a tests package.
* The venv folder contains the Python virtual environment, as before. 


3.心得感悟
粗读前半部分,获取三个框架:

整体项目框架 == app + migrations + tests + venv

单个application的框架 == Initialization + Routes and View Functions  +   Server Startup

整体结构框架 ==  Ttemplates + Web Forms + Databases + Email

了解基本运行原理,懂得多一点挺好。

这本书的整体思路不错,是一点点一层层展开讲解,能够白手起家读懂一个网页从小到大怎么发育长大成人的,不错。
但是需要补充javascript的知识。。。~

这个波兰英语,听着实在费劲!~~

4.时间统计
昨日阅读5小时,累计535小时
已有 2 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
充实每一天 + 70 精彩帖子
obaby85 + 5 + 5 + 5 精彩帖子

总评分: 论坛币 + 70  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

46
fcbarcelona 发表于 2018-4-27 09:57:33 来自手机
充实每一天 发表于 2018-4-27 05:55
【加入充实计划】【了解充实计划】

|新充实挑战|    |公告【想成为牛人】|
昨日阅读1小时 累计阅读176小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

47
ktl8818 发表于 2018-4-27 10:15:32
2018.4.27
昨日阅读4.5小时  累计阅读166.5小时。
匠人匠心:愚直的坚持-(日)稻盛和夫(日)山中伸弥 著
京瓷的经营哲学里面有“六项精进”这个内容,非常简单易懂:①付出不亚于任何人的努力;②要谦虚,不要骄傲;③要每天反省;④活着,就要感谢;⑤积善行,思利他;⑥不要有感性的烦恼。之所以加入了第六条,比如说,有的经营者在资金周转上遇到困难,担心自己资不抵债而破产,于是夜不能寐,结果把自己的身体搞垮了。而这样的烦恼,我觉得是非常没有意义的。在公司面临这样的问题之前就应该拼命努力让公司拥有足够的资金,这才是重要的。但即便是拼命努力,有时候自己的努力得不到回报,公司也可能会破产。到了那个时候,就只能让自己重新振作起来,从头再来了。
有句话叫作“覆水难收”,只要尽了全力最后即便失败了,我觉得也没有必要过多地去想“当时这样做就好了,那样做就好了”,这只会带来更多的烦恼。当然,必须好好地分析一下失败的原因,进行反省。而进行了足够的反省之后,就把之前的都忘掉,振作起来朝着新的目标再一次挑战、努力就行了。
稻盛:我经常被询问:“要在工作上取得好的成绩,应该怎样做呢?”对于回答这个问题,我有一个方程式。就是“人生·工作的结果=思维方式×热
情×能力”。
稻盛:这里面有三个要素,但最重要的就是当事人所拥有的对人生和工作的“思维方式”,第二是“热情”,第三才是“能力”。这里所说的“能力”,是指知能、学力或运动神经等,多数都是先天性的东西,不是个人主观意志所能掌控的。能力的得分,是从“0分”到“100分”。
“热情”或许可以更换为“努力”,这个项目的得分也是从完全没有干劲儿的“0分”到对工作怀有熊熊烈火一般的热情并拼命努力工作的“100分”。
而关于最重要的“思维方式”,得分却是从“负100分”到“正100分”。比如说这个人愤世嫉俗、怨恨他人,总是愤愤不满散发负能量,那这个人的“思维方式”的得分就是负值。相反,如果遇到苦难和挫折也能坦诚地接受别人的意见与建议,不怕辛苦,善良地对待他人,开朗、认真并且坚持不断努力,那么这个人的“思维方式”的得分就是正值。
稻盛:工作的结果就是这三个要素的乘积。学力和能力再高,如果对于自己的能力过于自信
而忽视了努力的话,那么他最后的工作结果也就不会很好。相反,能力虽然比较低,但工作的热情很高,付出超过他人多倍的努力,而且如果他的思维方式也是正向的话,那么他所能取得的成绩是非常巨大的。举个例子,比如有一个人学历很高,能力方面可以达到90分,
但他对自己的能力过于自信,觉得工作很轻松,于是就不去努力,那么他的热情可能就是40分,思维方式也只有50分,那最后算下来,他的工作的结果,乘一下就是18万分。相反,有一个人他的能力只有50分,但对工作的热情非常高昂,付出超过他人多倍的努力,那他的热情可以达到90分,再加上非常积极向上,能够善待队友和同事,那么他的思维方式可能就是80分,最后算下来他的结果是36万分。所以说即便是一个能力平平的人,只要有很好的思维方式,再加上拼命地努力,那他肯定能获得预想不到的优异成就。
实际上,无论是工作还是人生,他们都得到了按照方程式计算出来的结果。

用没有偏见的心看事物
还有就是要用没有偏见的心来看待问题。听说锻造日本刀的师傅在工作之前先要将自己的身体洗净,再对着神像进行祷告,然后才能打造日本刀。那其实并不仅仅是形式上的东西,而是通过这些形式让自己的心清澈透底,如果不是怀着这样纯粹的心,可能有些东西也就看不到了。

《你不可不知的人性》 心得:无
已有 1 人评分论坛币 收起 理由
充实每一天 + 50 精彩帖子

总评分: 论坛币 + 50   查看全部评分

48
xiaoyaoyou1 发表于 2018-4-27 10:38:41
昨日阅读0.5小时,累计阅读139.5小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

49
Greenwicher 学生认证  发表于 2018-4-27 10:47:11
昨日阅读1小时,累计阅读537小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

50
贝玉丰 发表于 2018-4-27 10:57:19
昨天阅读1.5小时,累计阅读1.5小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jr
拉您进交流群
GMT+8, 2025-12-26 03:48