pyhton learning website:
https://www.bilibili.com/video/BV1rT4y1v7uQ?p=24&vd_source=8b0b3b9fa5eb6692e45e9e45a52296f6
1. js
1.1 bootstrap
1.1.1 bootstrap.js and bootstrap.bundle.js cannot be placed together
When following the tutorial, when using the drop-down navigation bar function, I clicked and reported an error:
Uncaught TypeError: Popper__namespace.createPopper is not a function
The reason is that there is no reference to bootstrap.bundle.js
Then I directly put https://v5.bootcss.com/docs
Copy it from /components/navbar/ , but still can't click it.
I found that I had already quoted bootstrap.js before, and it would be useful to delete it.
1.2 plugins
1.1.1 The referenced js gets 404 when the page is accessed
Following the tutorial, I downloaded apache-echarts-5.4.2-src, and then I can’t use it when referencing echarts. The
reason is
1. First check whether there is a bunch of content in the referenced JS, not another reference
2. It is referenced by script in Django You can't bring the name of the APP, just start from static
2. Django
1.1 Verification code function check_code
1.1.1 font_file/font_path = "Monaco.ttf" in check_code must write an absolute address
font_file="D:\JetBrains\lianxi\webtest\app01\utils\Monaco.ttf"
If you do not write the absolute address, an error will be reported: cannot open resource
1.1.2 \a in font_file will have escaping problems and need to add r in front:
https://blog.csdn.net/yuan2019035055/article/details/126368281
font_file=r"D:\JetBrains\lianxi\webtest\app01\utils\Monaco.ttf"
has escaping problems, if you don't add R, you will get an error:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 33-34: truncated \uXXXX escape
1.1.3 The media folder is juxtaposed with the APP folder, not in the APP folder
Otherwise, [Errno 2] No such file or directory: 'media\Snipaste_.png' will be reported
3. CSS
3.1 Layui
3.1.1 Modal box modal
1. If the parent has a modal modal box, and a new modal box is added to the subset, it may happen that the subset triggers the modal box to be covered by the mask layer. At this time, it needs to be added to the modal of the subset data-backdrop="false"
for example
2. The form in the modal box needs to have form = xx in each subset def list, otherwise the content of the parent cannot be displayed on the subset page
4. python automated interface testing
4.1 unittest
Learning URL: https://www.bilibili.com/video/BV1va4y1i76B/?p=1
4.1.1 The header copied by Fiddler becomes a dictionary mode
参考网址:https://blog.csdn.net/huangwencai123/article/details/89792493
def parse_fidder_cookie(cookie):
itemDict = {}
items=cookie.split(‘\n’)
for item in items:
key = item.split(‘:’)[0].strip()
if key :
value = item.split(‘:’)[1].strip()
itemDict[key] = value
return itemDict
cookie=“”“Device-Id: 00000000-5ae8-e179-a0f9-233a0033c587"”"
4.1.2 Python comments and string multi-line assignment
Reference URL: https://blog.csdn.net/qq_41994144/article/details/113978234
""" """ If you do not assign a comment to a variable in python, it means a comment. After assigning a value to a variable, it becomes a character string multiline assignment
4.1.3 How to reference the data df read in one def in python in another def
Reference URL: https://blog.csdn.net/weixin_42601702/article/details/129557760
def parse_fidder_cookie(self,cookie):
itemDict = {}
return itemDict
def api_post_login(self,url,itemDict):
headers = itemDict
return requests.post(headers=itemDict)
itemDict = ApiLogin().parse_fidder_cookie(cookie)
s = ApiLogin().api_post_login(url,itemDict)
4.1.4 TypeError: xxx() takes 1 positional argument but 2 were given
Solution: https://blog.csdn.net/ly_qiu/article/details/107665641
The front function (def) called in unittest needs to have self in all parameters. For example: def parse_fidder_cookie(self,cookie):