【问题标题】:How to remove used endpoints when running flask application using virtual env使用虚拟环境运行烧瓶应用程序时如何删除使用的端点
【发布时间】:2014-03-25 17:08:48
【问题描述】:

我有一个包含代码的视图 python 文件:

@app.route('/')
def index():
  page = """
  <html>
  <head>
  </head>
  .....
  ...
  </html>

我对该文件进行了一些更改,这些只是正常的更改,例如导入render_template。我能够在我的localhost 中使用foreman start 命令查看html 文件。但是,在我前面提到的一些更改之后,当我再次开始使用工头启动时,我收到一个错误 - " View function mapping is overwriting an existing endpoint function: index "

但是,当我使用 @app.route('/',endpoint ="new") 时,它起作用了。

看起来它保留了一些端点并且不让我覆盖它。如何删除所有端点以重新开始。

【问题讨论】:

  • 你能分享你定义这个视图的整个文件吗?

标签: python flask foreman


【解决方案1】:

确保没有两条具有相同 URI 的路由。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-28
    • 2015-07-05
    • 1970-01-01
    • 1970-01-01
    • 2016-07-12
    • 1970-01-01
    • 2021-09-13
    • 2016-03-09
    相关资源
    最近更新 更多