簡體   English   中英

如何在谷歌應用引擎上提供靜態文件

[英]how to serve static files on google app engine

基本上我是google app引擎的新手,我有一個名為templates的文件夾,其中有幾個文件:

index.php
result.php
request.php

但是在yaml.app上我只想出了如何通過制作templates / index.php默認頁面來本地運行服務器。 我的意思是當我去http://localhost:8080這就是我所看到的。 但是,當我執行http://localhost:8080/templates/index.php它說404找不到。 如何在我的應用程序內的任何目錄中使用我想要的所有文件,是否應該添加到我的app.yaml中的某些規則?

這是當前的app.yaml即時通訊使用:

application: sympy-live-hrd
version: 38

runtime: python27
threadsafe: true
api_version: 1

libraries:
- name: numpy
  version: latest
- name: matplotlib
  version: latest

handlers:
- url: /static
  static_dir: static
  expiration: 1d

# cache-busting scheme
# request /static-(app version)/filename
- url: /static-[0-9]+/(.*)
  static_files: static/\1
  upload: static/(.*)

# if you're adding the shell to your own app, change this regex url to the URL
# endpoint where you want the shell to run, e.g. /shell . You'll also probably
# want to add login: admin to restrict to admins only.
- url: .*
  script: shell.application

Shell.application是我編輯的python腳本,默認使用templates / index.php

我假設index.php是一個腳本?

我相信你必須使用php運行時運行php腳本。 它們不會作為python運行時的腳本運行,所以首先,你將無法運行php腳本。

其次,您需要一個指向您的模板文件夾的處理程序,但這不存在。

handlers:
- url: /templates
  static_dir: templates
  expiration: 1d

請注意,這只會加載文件,除非您使用的是php運行時,否則它不會運行php文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM