-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
55 lines (28 loc) · 1.79 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
In Python, a decorator is a design pattern that allows you to
modify the functionality of a function by wrapping it in
another function. The outer function is called the decorator,
which takes the original function as an argument and returns
a modified version of it123. Decorators provide a simple
syntax for calling higher-order functions1.
However, to understand decorators, it is enough to think
about functions as something that turns given
arguments into a value.
set Flask_App=app.py
###debug true
set Flask_DEBUG=1
where is this file located
href=""
What is the use of autopep8?
autopep8 automatically formats Python code to conform to the PEP 8 style guide. It uses the pycodestyle utility to determine what parts of the code needs to be formatted. autopep8 is capable of fixing most of the formatting issues that
can be reported by pycodestyle.
########################### this date is attribute
<p> By {{post.author }} on {{post.date}}</p>
## this posts is variable
{% for post in posts %}
and this argument is equal to our post dictionary dumy data
return render_template('home.html', posts=posts)
Flask's url_for tag that is used here, creates the appropriate path to the file. Because it can accept variables as arguments, url_for allows you to programmatically control the generated path, if desired.
ecause you'll likely create many pages that extend the same template, it's helpful to create a code snippet in VS Code with which you can quickly initialize new page templates. A snippet helps you avoid tedious and error-prone copy-paste operations.
The following sections walk through different parts of this process
words::::
that can creep in when using copy-paste from existing code.