[英]Django returning 500 Internal Server Error instead of index.html when Debug = False
[英]500 server error doesn't serve index.html
我正在使用python 2.7將非常簡單的網站部署到Google雲,並且收到500服務器錯誤錯誤消息“服務器遇到錯誤,無法完成您的請求。請在30秒內重試。” 我是Python新手,我懷疑問題出在我的app.yaml和/或main.py上。 他們來了:
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文件提供服務? 還有什么我應該做的嗎?
謝謝,
威廉
我知道了 我沒有使用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))
就是這樣! 沒有大驚小怪,沒有頭腦。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.