07 2024 档案

摘要:1. templates模板(html) 在app目录下创建一个templates目录,用于存放网页模板 利用url返回网页 点击查看代码 def user_list(request): return render(request,"user_list.html"); 输入url地址时,会去app目 阅读全文
posted @ 2024-07-31 20:54 Coder-Yun 阅读(16) 评论(0) 推荐(0) 编辑
摘要:1. APP 定义:Django中功能的细分,每个APP有独立的数据库、表结构、HTML模版、CSS。 创建APP python manage.py startapp app01 重要文件介绍 views.py:常用文件,urls中的函数常常在此处定义。 models.py:常用文件,对数据库进行操 阅读全文
posted @ 2024-07-29 21:47 Coder-Yun 阅读(14) 评论(0) 推荐(0) 编辑
摘要:1. 安装 pip install django 【注】:Django安装完后,存放于Lib下的site-packages中。 2. 创建项目 终端创建 "D:\Python\Python312\Scripts\django-admin.exe" startproject mysite2 djang 阅读全文
posted @ 2024-07-29 20:59 Coder-Yun 阅读(62) 评论(0) 推荐(0) 编辑
摘要:1. 多返回值 返回值为return返回给上级函数的值,需要注意的是,与C和C++不同,Python中可以有多返回值。 多返回值 def test_return(): return 1,2 x, y = test_return() print(x) print(y) 特点: 按照返回值的顺序,写对应 阅读全文
posted @ 2024-07-14 21:14 Coder-Yun 阅读(6) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示