显示索引.html当GAE中没有指定页面URL时

2024-05-17 07:00:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望用户和查看者在导航到不指向文件的URL时能够看到index.html文件。
例如>;
x.appspot.comx.appspot.com/
应显示/解析为x.appspot.com/index.html

x.appspot.com/pagex.appspot.com/page/
两者都对应于x.appspot.com/page/index.html。你知道吗

我有以下代码应用程序yml文件。你知道吗

application: avi-aryan
version: secureable
runtime: python
api_version: 1

handlers:

- url: /.*
  script: mirror.py
  secure: optional

- url: /
  static_files: index.html
  upload: index.html

我两小时前刚开始学GAE,所以一个字都不懂。你知道吗

编辑 我正在为我的Dropbox-based project设置一个URL。这是mirror.py
我感觉到了索引.html可以直接从镜像.py当URL包含没有结尾的扩展名(.html,.js,.bmp…)但我不懂python时。你知道吗


Tags: 文件代码用户pygtcomurlindex
2条回答

还有一个dropbbox的克隆版本,它内置了这个能力镜像.py 在https://code.google.com/r/icaromorpheus-dropbox-hostserver/ -迈克。你知道吗

处理程序的URL按写入顺序匹配。/.*也匹配根路径/。你知道吗

您可以通过切换处理程序来解决此问题

application: avi-aryan
version: secureable
runtime: python
api_version: 1

handlers:
- url: /
  static_files: index.html
  upload: index.html

- url: /.*
  script: mirror.py
  secure: optional

可能是那个文件吗索引.html不存在吗? 下面是一个云游乐场的例子,我让它工作:

https://cloud-playground.appspot.com/playground/p/4882615509188608/#index.html

相关问题 更多 >