Django解決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 rows='*' cols='265,*' framespacing='0' frameborder='yes' border='0'> <frame src='http://m.b3g6.com/left' name='leftFrame' scrolling='auto' noresize> <frame src='http://m.b3g6.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ò)誤。


在setting.py中設(shè)置:
# 解決frame跨域問題X_FRAME_OPTIONS = ’ALLOWALL url’
到此這篇關(guān)于Django解決frame拒絕問題的方法的文章就介紹到這了,更多相關(guān)Django frame拒絕內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. JS實(shí)現(xiàn)前端動態(tài)分頁碼代碼實(shí)例2. 關(guān)于IDEA 2020.3 多窗口視圖丟失的問題3. javascript實(shí)現(xiàn)貪吃蛇小練習(xí)4. js實(shí)現(xiàn)碰撞檢測5. 一文帶你徹底理解Java序列化和反序列化6. 用Spring JMS使異步消息變得簡單7. PHP驗(yàn)證碼工具-Securimage8. Python 制作查詢商品歷史價(jià)格的小工具9. Python 利用Entrez庫篩選下載PubMed文獻(xiàn)摘要的示例10. ASP.NET MVC使用jQuery ui的progressbar實(shí)現(xiàn)進(jìn)度條

網(wǎng)公網(wǎng)安備