Django解決frame拒絕問(wèn)題的方法
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ò)誤。
在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)!
相關(guān)文章:
1. 在vue中封裝方法以及多處引用該方法詳解2. Google和Facebook不使用Docker的原理解析3. Django models文件模型變更錯(cuò)誤解決4. Spring注解實(shí)現(xiàn)自動(dòng)裝配過(guò)程解析5. django rest framework serializers序列化實(shí)例6. 探究Android客戶端網(wǎng)絡(luò)預(yù)連接優(yōu)化機(jī)制7. idea給項(xiàng)目打war包的方法步驟8. Docker部署Rabbitmq容器實(shí)現(xiàn)過(guò)程解析9. Spring boot基于ScheduledFuture實(shí)現(xiàn)定時(shí)任務(wù)10. docker 部署 Elasticsearch kibana及ik分詞器詳解
