2013-07-28 84 views
0

基本上我是新來的谷歌應用程序引擎的靜態文件,我有一個名爲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 IM:

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是我編輯使用模板/ index.php文件默認

+0

https://developers.google.com/appengine/docs/python/gettingstartedpython27/staticfiles –

+0

我已經是紅色的文檔,但我仍然困惑如何實現它。 –

+0

與**完全相同** –

回答

2

我假設指數python腳本.php是一個腳本?

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

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

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

請注意,這隻會加載文件,它不會運行php文件,除非你使用php運行時。

+0

是的,我固定處理程序的一部分,正如你所說的PHP文件不會被加載,但下載。我不能同時運行python和php嗎? –

+0

似乎不是,你應該提及你想使用的運行時間 – marcadian

+1

檢查出新的模塊功能。應用程序中的不同模塊可以運行不同的運行時,但任何單個實例只能運行一個運行時。 https://developers.google.com/appengine/docs/python/modules/ 你想要做什麼應該是可能的,但你需要設置你的PHP代碼在PHP運行時模塊,處理PHP網址。 – dragonx