Django解决frame拒绝问题的方法
程序员文章站
2022-03-22 15:38:22
一、home页使用frametemplate/home.html
一、home页使用frame
template/home.html
<!doctype html> <html lang="en"> <meta http-equiv="content-type" content="text/html" charset="utf-8"> <head> <title>自动化测试平台</title> </head> <frameset id="frame" rows="*" cols="265,*" framespacing="0" frameborder="yes" border="0"> <frame src="../left" name="leftframe" scrolling="auto" noresize> <frame src="../welcome" name="mainframe" scrolling="no" noresize> </frameset> <noframes> <body> <h1>hello</h1> </body> </noframes> </html>
二、视图文件
autotestplat/views.py
def home(request): return render(request, 'home.html') def left(request): return render(request, 'left.html') def welcome(request): return render(request, 'welcome.html')
三、urls映射文件
urlpatterns = [ path('admin/', admin.site.urls), path('', views.login), path('login/', views.login), path('home/', views.home), path('left/', views.left), path('welcome/', views.welcome), ]
命令行执行python manage.py runserver后,chrome浏览器打开http://127.0.0.1:8000/home/,显示如下图。打开f12,报以下错误。
四、解决方案
在setting.py中设置:
# 解决frame跨域问题 x_frame_options = 'allowall url'
到此这篇关于django解决frame拒绝问题的方法的文章就介绍到这了,更多相关django frame拒绝内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
上一篇: vue中如何添加百度统计代码
下一篇: golang连接kafka消费进ES操作
推荐阅读
-
php substr截断中文半个汉字乱码问题的解决方法
-
关于页面嵌入swf覆盖div层的问题的解决方法_javascript技巧
-
修复 Django migration 时遇到的问题解决
-
Zend Studio 无法启动的问题解决方法
-
PHP调用存储过程返回值不一致问题的解决方法分析_PHP
-
表单提交错误后返回内容消失问题的解决方法(PHP网站)
-
解决yii2左侧菜单子级无法高亮问题的方法,yii2菜单子
-
UCweb判断wap的方法-解决uc下网站重复提交问题 WAPUCWeb浏览器AndroidXML
-
Ajax跨域访问Cookie丢失问题的解决方法_AJAX相关
-
jquery hover 不停闪动问题的解决方法(亦为stop()的使用)