我正在使用 Google App Engine 和 Python,我无法列出静态目录的文件。下面是我目前使用的代码。
应用程序.yaml
- url: /data
static_dir: data
列出文件的 Python 代码
myFiles = []
for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), 'data/') ):
for name in files:
full_name = os.path.join(root, name)
myFiles.append('%s;%s\n' % (name, datetime.fromtimestamp(os.stat(full_name).st_mtime)))
当我在我的机器上本地运行这段代码时,一切都很好。我的 Python 脚本位于目录的根目录,它遍历数据目录下的文件。但是,当我在 GAE 中上传并运行完全相同的代码时,它不起作用。在我看来,我的应用程序的目录结构并没有完全复制到 Google App Engine 中。静态文件在哪里?
谢谢!