后端处理好数据后,需要由前端展示出来,页面效果如下:
那前端文件应该放哪里,又该如何访问呢?我们在项目中导入一个存储前端信息的前端文件夹。
1、打开项目配置文件中的urls.py 文件,导入静态文件服务
from django.conf.urls.static import static
2、末尾添加
+ static("/", document_root="./ylj")
3、启动浏览器
python manage.py runserver 80
4、浏览器中输入:
http://localhost/mgr/index.html
即可通过前端对后端数据进行操作。
前端的具体写法,我们以后有缘再说。