让Flask从磁盘读取文件并将其发送给用户

时间:2013-07-30 22:23:59

标签: python flask flask-sqlalchemy

我有一个非常简单的问题,我似乎无法理解。

我有一个简单的Flask应用程序。我想从磁盘读取一个XML文件并将其发送给用户,但Flask继续返回404.这是我的代码:

@app.route('/update.php')
@app.route('/update')
def send_sparkle_xml():
    """ Send the Sparkle XML file if someone does a GET on the update URL. """

    return send_from_directory(directory='files', filename='updates.xml')

updates.xml存在于名为files的目录中,与显示的脚本位于同一级别。我只是继续得到404,不知道为什么。

0 个答案:

没有答案
相关问题