【Django】模型
1.模型 模型(model, MVC中的M)对应一个数据库表,相当于实体类。 官方文档:https://docs.djangoproject.com/en/stable/topics/db/models/ 1.1 定义模型 应用目录下的models.py定义应用中使用的模型,每个模型都是django.db.models.Model的子类,类属性(Field类的实例)对应数据库中的字段,默...
1.模型 模型(model, MVC中的M)对应一个数据库表,相当于实体类。 官方文档:https://docs.djangoproject.com/en/stable/topics/db/models/ 1.1 定义模型 应用目录下的models.py定义应用中使用的模型,每个模型都是django.db.models.Model的子类,类属性(Field类的实例)对应数据库中的字段,默...
1.配置数据库 官方文档: https://docs.djangoproject.com/en/stable/ref/databases/ https://docs.djangoproject.com/en/stable/ref/settings/#databases settings.py中的DATABASES指定项目使用的数据库。 1.1 SQLite DATABASE...
1.视图 视图(view, MVC中的V)用于处理请求并返回特定功能的Web页面,用Python函数或类方法表示。 官方文档:https://docs.djangoproject.com/en/stable/topics/http/views/ Django实际上采用的是MTV (Model-Template-View)模式,与Spring MVC的对应关系如下: ...
1.简介 Django是一个免费、开源的Python web框架,解决了web开发的许多麻烦,使开发者可以专注于编写应用而无需重复造轮子。 网站:https://www.djangoproject.com/ 官方文档:https://docs.djangoproject.com/ 源代码:https://github.com/django/django 2.安装 使用pi...
以官方教程QuotesSpider为例,结合源码分析一下Scrapy中response的处理过程。 下面是待爬取的网页,红框中的是目标HTML标签: 1.quote文字内容 2.下一页链接 QuotesSpider代码如下: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" ...
通常运行Scrapy爬虫的方法是在工程目录下执行scrapy crawl <spider>命令,而不是直接运行Python脚本,因此无法直接命中断点。执行scrapy命令时实际上是执行了scrapy.cmdline模块,因此在PyCharm中添加一个运行该模块的配置即可。 1.点击左上角的”Add Configuration…” 2.添加一个Python运行配置 3...
官方文档: https://developer.android.google.cn/guide/components/activities/activity-lifecycle?hl=zh_cn#saras https://developer.android.google.cn/topic/libraries/architecture/saving-s...
使用WebView可以显示HTML内容 官方文档:https://developer.android.google.cn/guide/webapps/webview 参考: https://blog.csdn.net/u012810020/article/details/52708557 https://blog.csdn.net/fengyu...
官方文档:https://developer.android.google.cn/guide/components/fragments.html?hl=zh_cn 参考: https://www.cnblogs.com/DreamRecorder/p/8961987.html https://blog.csdn.net/qq_39494252/ar...
Room是Google官方提供的数据库框架(相当于Android版的Spring Data JPA),官方强烈建议使用Room而不是SQLite API Room在SQLite上提供了一个抽象层,可以更方便地访问和操作数据库,大大减少代码量 官方文档:https://developer.android.google.cn/training/data-storage/room ...