xiaxue0622 2017-01-25 15:41 采纳率: 0%
浏览 10682

python运行html无法实现html页面间的跳转

如题。
用的flask,两个网页index.html和test.html放在templates里,index.py放在根目录下。

index.html下面写了一个跳转:

 <a href="../templates/test.html">Switch to baidu</a>

如果单独运行这个index.html的话可以跳转到test.html,
但是如果通过后端的index.py运行的话

 index.py:
@app.route('/')
def index():
  return render_template('index.html')

能成功进入Index.html,但是从index.html进入test.html的时候就会显示:

Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

编译器pycharm里显示:
127.0.0.1 - - [25/Jan/2017 23:24:00] "GET /templates/test.html HTTP/1.1" 404 -

有木有哪位大神哥哥帮忙指导一下/(ㄒoㄒ)/~~

  • 写回答

10条回答 默认 最新

  • 一应常怀 2019-04-25 12:18
    关注

    同问~~~~~~我也是在html中用了a标签,herf = 'xxx.html'单独运行可以跳,但是在flask中就跳不了

    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿