一、数据库
1.数据库迁移
数据库文件链接:https://pan.baidu.com/s/1vICXADca2e3F_Zc49sdR6w
提取码:0ms1
-
将这两个文件放入到info文件夹下
-
数据库迁移思维导图
- 迁移数据库
python manage.py db init

会出现一个migrations文件夹

- 我们将models导入到manage.py中
from info import create_app, db,models

- 打开info/init.py文件
#SQLAlchemy对象关联app
db.init_app(app)

python manage.py db migrate -m"initial"

产生了一个数据文件

-
打开数据库发现只有一个迁移的表
python manage.py db upgrade

-
刷新数据库,产生表
2.数据导入
数据信息链接:https://pan.baidu.com/s/1sraVUX6Kw4ERJMWzUnlHHQ
提取码:c49s
-
打开数据库,右击数据库的运行SQL文件
-
同样方法导入news的数据
二、网页图标
- 打开views.py文件
@index_blu.route('/favicon.ico')
def get_web_logo():
return current_app.send_static_file('news/favicon.ico')

-
刷新页面
图标出现
三、架构整理

以上项目可在我的GitHub上面查看:
(此文章仅作为个人学习笔记使用,如有错误欢迎指正~)
网友评论