Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 找不到瓶子模板(错误500)_Python_Python 2.7_Template Engine_Bottle - Fatal编程技术网

Python 找不到瓶子模板(错误500)

Python 找不到瓶子模板(错误500),python,python-2.7,template-engine,bottle,Python,Python 2.7,Template Engine,Bottle,我计划制作文件管理器系统,但奇怪的是,当我应用返回目录内容的函数时,它会引发一个错误 这是我返回目录内容的函数(在我的机器上100%工作) 这里是来自文件管理器系统的代码 @route("/TofePanel/FileManager/<filepath:path>") def FileMamager(filepath): if request.get_cookie("__auth",secret="xxxxxxxx") is "xxxxxxxx": cont=

我计划制作文件管理器系统,但奇怪的是,当我应用返回目录内容的函数时,它会引发一个错误

这是我返回目录内容的函数(在我的机器上100%工作)

这里是来自文件管理器系统的代码

@route("/TofePanel/FileManager/<filepath:path>")
def FileMamager(filepath):
    if request.get_cookie("__auth",secret="xxxxxxxx") is "xxxxxxxx":
        cont=GET_Contents(filepath)#just calling the function and ignore result
        return template("static/templates/TCP/FileMgr",PATH=filepath)
    else:
        redirect("/TofePanel/Login")
@route(“/TofePanel/FileManager/”)
def FileMaManager(文件路径):
如果request.get\u cookie(“\u auth”,secret=“xxxxxxxx”)是“xxxxxxxx”:
cont=GET_Contents(filepath)#只调用函数并忽略结果
返回模板(“static/templates/TCP/FileMgr”,PATH=filepath)
其他:
重定向(“/TofePanel/Login”)
它会引发一个错误,提示:
Template'static/templates/TCP/FileMgr'未找到。

但是当我注释
cont=GET_Contents(filepath)#只需调用函数并忽略结果
就可以了

不要更改工作目录;模板加载逻辑依赖于当前工作目录保持稳定

无需更改工作目录,即可轻松列出目录:

def GET_Contents(filepath):
    return os.listdir(os.path.join('files', filepath))

先生你太棒了
def GET_Contents(filepath):
    return os.listdir(os.path.join('files', filepath))