Answer the question
In order to leave comments, you need to log in
Adding a Variable Part to the URL Causes a CSS Backlog?
there is such a route, the page is successfully rendered with CSS
@app.route('/test/<version>')
def func1(version):
return render_template('index.html', version=version)
@app.route('/test/<version>/<num>')
def func1(version, num):
return render_template('index.html',version=version, num=num)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../static/style.css">
</head>
Answer the question
In order to leave comments, you need to log in
Because your stylesheet URL is relative. Get absolute as described in the documentation :
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question