2017-06-20 104 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)) 

就是这样!没有大惊小怪,没有麻烦。