Answer the question
In order to leave comments, you need to log in
Why isn't my style showing up?
Good afternoon. The crux of the matter is this. I decided to learn Flask, and write a small site on it. I attached Bootstrap to the template, which works great for itself and decided to include my style file as well.
But that's not the problem my style file is not applied to the template. I can't figure out what's wrong.
The code of the template itself with connected styles:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
<title>VK - 6 рукопожатий</title>
</head>
<body>
<div class="menu-container">
<div class="logo">
<a href="#"><img ></a>
</div>
<nav class="menu">
<ul>
<li><a href="/">Связи друзей</a></li>
<li><a href="#">Общие друзья</a></li>
</ul>
</nav>
</div>
<script src="{{ url_for('static', filename="js/jquery-3.2.1.min.js") }}"></script>
<script src="{{ url_for('static', filename="js/bootstrap.min.js") }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
</body>
</html>
rom flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def hello_world():
return render_template("index.html")
if __name__ == '__main__':
app.run()
Answer the question
In order to leave comments, you need to log in
Obviously you haven't restarted the flask app itself.
change:
to:
In this case, everything will happen automatically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question