删除文件扩展名Google App Engine

esd*_*ker 2 html google-app-engine clean-urls

我使用Google App Engine上传了客户的网页,并且运行正常。这是一个非常简单的网页,包含12个静态文件(全部为.html)

我必须删除该文件,但我不知道是否可以通过修改app.yaml或 main.py

例如:我有www.example.com/page.html,我想要www.example.com/page

Fai*_*sal 5

假设所有html文件都在静态文件夹中,则可以在app.yaml上尝试此操作。

handlers:

- url: /(.+)
  mime_type: text/html
  static_files: static/\1.html
  upload: static/(.+)
Run Code Online (Sandbox Code Playgroud)

这意味着它将匹配所有文件并查找带有.html扩展名的静态文件夹(如果您想要特定的文件)

- url: /(hello|world)
  mime_type: text/html
  static_files: static/\1.html
  upload: static/(.+)
Run Code Online (Sandbox Code Playgroud)

表示仅文件hello.html和world.html,以避免处理所有url。