1.不显示iframe中内容

浏览器打开页面报错:

微信截图_20200811174821.png

Refused to display 'http://localhost:8000/cdny/student_manage/' in a frame because it set 'X-Frame-Options' to 'deny'.

解决方案:
settings.py中加一条配置:

X_FRAME_OPTIONS = 'SAMEORIGIN'  
# DENY :表示该页面不允许在 frame 中展示,即便是在相同域名的页面中嵌套也不允许  
# SAMEORIGIN :表示该页面可以在相同域名页面的 frame 中展示  
# ALLOW-FROM uri :表示该页面可以在指定来源的 frame 中展示
2.不加载js文件

浏览器打开页面报错:

微信图片_20200811174053.png

Refused to execute script from 'http://127.0.0.1:8000/static/layui/layui.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

解决方案:
修改settings.py配置

SECURE_CONTENT_TYPE_NOSNIFF = False

然后清空浏览器缓存,重启浏览器