2017-06-20 101 views
0

我正在使用python 2.7將一個非常簡單的網站部署到Google雲中,並且我收到500 Server Error錯誤消息「服務器遇到錯誤,無法完成您的請求,請在30秒後重試。「我是Python的新手,我懷疑問題出在我的app.yaml和/或我的main.py上。在這裏,他們是:500服務器錯誤不提供index.html

的app.yaml:

runtime: python27 
api_version: 1 
threadsafe: true 

handlers: 

- url:/
    script: home.app 

- url: /index\.html 
    script: home.app 

- url: /(.*\.(gif|png|jpg|ico|js|css|zip|xlsm|html)) 
    static_files: \1 
    upload: (.*\.(gif|png|jpg|ico|js|css|zip|xlsm|html)) 

- url: .* 
    script: myapp.app 

vm_health_check: 
    enable_health_check: False 

main.py:

import webapp2 

class MainPage(webapp2.RequestHandler): 
    def get(self): 
     self.render('index.html') 

app = webapp2.WSGIApplication([('/index.html', MainPage)]) 

的服務器來服務index.html文件,但事實並非如此。如何在頁面加載時修改app.yaml或main.py文件以使服務器爲index.html文件提供服務?還有什麼我該做的呢?

感謝,

威廉

回答

0

我得到它的工作。我沒有使用main.py,而是使用了app.yaml文件。這裏是新版本的app.yaml:

runtime: python27 
api_version: 1 
threadsafe: true 

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


- url: /(.*\.(gif|png|jpg|ico|js|css|zip|xlsm|html)) 
    static_files: \1 
    upload: (.*\.(gif|png|jpg|ico|js|css|zip|xlsm|html)) 

就是這樣!沒有大驚小怪,沒有麻煩。