Flask를 (Flask-Bootstrap과 함께) 가져 와서 HTML 요소에 하나의 head 요소 만 생성하려고하는데 문제가 있습니다. 내가 지금 가지고있는 문제는 헤드 요소가 정확하다는 것이다. 그러나 플라스크는 그것을 몸의 시작 부분에 떨어 뜨린다.Flask가 내 html 문서의 머리 부분을 두 번 렌더링합니다.
/personal_website/app/templates/index.html :
{% extends "bootstrap/base.html" %}
#! I have not changed bootstrap/base.html
{% block head %}
{{super()}}
{% block title %}My_Name | Home{% endblock title %}
{% block styles %}
{{super()}}
<link href="{{url_for('static',filename='stylesheets/style.css')}}"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto"
rel="stylesheet">
{% endblock styles %}
{% endblock head %}
콘솔 출력 :
<head>
<title>My_Name | Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/stylesheets/style.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
<body>
My_Name | Home
<!-- Bootstrap -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/stylesheets/style.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">