【问题标题】:calling different html pages using href使用 href 调用不同的 html 页面
【发布时间】:2019-04-25 18:26:22
【问题描述】:

在运行烧瓶文件后,我试图通过标签中的 href 调用不同的 HTML 页面。但它给出了 没找到
在服务器上找不到请求的 URL。如果您手动输入了 URL,请检查您的拼写并重试。我哪里错了。 ` index.html

<section>
  <nav>
    <ul>
      <li><a href="index.html" class="button js-button" role="button">
      <i class="fa fa-file" aria-hidden="true"></i>&nbsp;  File &nbsp; &nbsp;  </a></li>
      <br><br>
      <li><a href="imageupload.html" class="button js-button" role="button"><i class="fa fa-file-image-o" aria-hidden="true"></i>&nbsp; Image</a></li>
      <br><br>
      <li><a href="addtext.html" class="button js-button" role="button"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp;  Text &nbsp;</a></li>
    </ul>
  </nav>

` 应用程序.py

 app = Flask(__name__)
app.secret_key = 'random string'
#app.config['UPLOAD_FOLDER'] = 'templates/'

APP_ROOT = os.path.dirname(os.path.abspath(__file__))

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

【问题讨论】:

    标签: html flask


    【解决方案1】:

    试试这个:

    &lt;a href="{{ url_for('index.html') }}" class="button js-button" role="button"&gt;

    更多关于模板的信息可以在这里找到:http://flask.pocoo.org/docs/1.0/templating/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      • 2020-03-07
      • 2020-04-29
      • 2017-04-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-02
      相关资源
      最近更新 更多