成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Django解決frame拒絕問(wèn)題的方法

瀏覽:205日期:2024-09-15 08:01:07
一、home頁(yè)使用frame

template/home.html

<!DOCTYPE html><html lang='en'><meta http-equiv='Content-Type' content='text/html' charset='UTF-8'><head> <title>自動(dòng)化測(cè)試平臺(tái)</title></head><frameset rows='*' cols='265,*' framespacing='0' frameborder='yes' border='0'> <frame src='http://www.piao2010.com/left' name='leftFrame' scrolling='auto' noresize> <frame src='http://www.piao2010.com/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),]

命令行執(zhí)行python manage.py runserver后,Chrome瀏覽器打開http://127.0.0.1:8000/home/,顯示如下圖。打開F12,報(bào)以下錯(cuò)誤。

Django解決frame拒絕問(wèn)題的方法

Django解決frame拒絕問(wèn)題的方法

四、解決方案

在setting.py中設(shè)置:

# 解決frame跨域問(wèn)題X_FRAME_OPTIONS = ’ALLOWALL url’

到此這篇關(guān)于Django解決frame拒絕問(wèn)題的方法的文章就介紹到這了,更多相關(guān)Django frame拒絕內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Django
相關(guān)文章: