问题遇到的现象和发生背景
我想要在flask中实现这种多个页面的切换,本来用超链接就可以,但是在layui框架中,我发现只有用url_for才起作用,可是只有一个页面起作用,其他都layui相关的全部404
######这是我app.py里的构造
```python
from flask import Flask, render_template, jsonify, request, redirect, url_for
import config
import utils
app = Flask(__name__)
app.config.from_object(config)
@app.route('/', methods=['get', 'post'])
def index(): # put application's code here
labels = ['名字', '经度', '纬度']
content = utils.get_sk()
# content = [i[0] for i in content]
if request.method == 'post':
return redirect(url_for('main1'))
return render_template("index.html", labels=labels, content=content)
@app.route('/main1', methods=['get', 'post'])
def main1(): # put application's code here
return render_template("main.html")
@app.route('/main1/11/')
def shuiku1():
return render_template("shuiku1.html")
@app.route('/main1/12/')
def shuiku2():
return render_template("shuiku2.html")
@app.route('/main1/13/')
def shuiku3():
return render_template("shuiku3.html")
@app.route('/main1/21/')
def temp1():
return render_template("temp1.html")
@app.route('/main1/22/')
def temp2():
return render_template("temp2.html")
@app.route('/main1/23/')
def temp3():
return render_template("temp3.html")
@app.route('/main1/24/')
def temp4():
return render_template("temp4.html")
@app.route('/main1/<is_where>/', methods=['get', 'post'])
def question(is_where): # put application's code here
if request.method == 'POST':
if is_where == '11':
return redirect(url_for('shuiku1'))
elif is_where == '12':
return redirect(url_for('shuiku2'))
elif is_where == '13':
return redirect(url_for('shuiku3'))
elif is_where == '21':
return redirect(url_for('temp1'))
elif is_where == '22':
return redirect(url_for('temp2'))
elif is_where == '23':
return redirect(url_for('temp3'))
elif is_where == '24':
return redirect(url_for('temp4'))
else:
return redirect(url_for('index'))
###### 运行结果及报错内容
这样就会导致layui.css404
想问一下有没有大佬有什么解决方法