Django解決frame拒絕問題的方法
更新時間:2020年12月18日 14:11:27 作者:湯圓兒2019
這篇文章主要介紹了Django解決frame拒絕問題的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
一、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), ]
命令行執(zhí)行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拒絕內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Python 調用 C++ 傳遞numpy 數(shù)據(jù)詳情
這篇文章主要介紹了Python 調用 C++ 傳遞numpy 數(shù)據(jù)詳情,文章主要分為兩部分,c++代碼和python代碼,代碼分享詳細,需要的小伙伴可以參考一下,希望對你有所幫助2022-03-03pandas讀取csv格式數(shù)據(jù)時header參數(shù)設置方法
本文主要介紹了pandas讀取csv格式數(shù)據(jù)時header參數(shù)設置方法,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-02-02python 實現(xiàn)矩陣上下/左右翻轉,轉置的示例
今天小編就為大家分享一篇python 實現(xiàn)矩陣上下/左右翻轉,轉置的示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-01-01