简体   繁体   English

伺服器错误找不到要求的网址

[英]Requested url not found on server error

I made a website which I am temporarily hosting in app engine. 我做了一个网站,暂时在应用程序引擎中托管。 I am able to navigate through the pages when I open the HTML files on my computer. 当我在计算机上打开HTML文件时,可以浏览页面。 It only fails when I head to http://www.alshafarconstruction.appspot.com/index.html . 只有当我转到http://www.alshafarconstruction.appspot.com/index.html时,它才会失败。

Error Message: 错误信息:

Error: Not Found

The requested URL /contact.html was not found on this server

app.yaml: app.yaml中:

application: alshafarnew
version: 1
runtime: python
api_version: 1

handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css|swf|xml))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css|swf|xml))

- url: /(.*\.html)
  static_files: \1
  upload: index.html

- url: /.*
  script: main.py

main.py: main.py:

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class IndexHandler(webapp.RequestHandler):
    def get(self):
        if self.request.url.endswith('/'):
            path = '%sindex.html'%self.request.url

        self.redirect(path)

    def post(self):
        self.get()

application = webapp.WSGIApplication([('/.*', IndexHandler)], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

I've checked the dashboard and find that the HTML files are there. 我检查了仪表板,发现HTML文件在那里。 I am new to website deployment and design. 我是网站部署和设计的新手。 Can anyone suggest possible errors? 谁能建议可能的错误? I have already visited many sites for a solution. 我已经访问过许多站点以寻求解决方案。

The documentation hints that static and application files are uploaded separately, so while the files may be there, it might be that they're being uploaded in the application-files part. 该文档提示静态文件和应用程序文件是分别上传的,因此尽管文件可能在那里,但可能是它们在应用程序文件部分中上传了。

You currently have an upload directive telling it to only upload index.html : 您当前有一个upload指令,告诉它仅上传index.html

- url: /(.*\.html)
  static_files: \1
  upload: index.html

(actually, it's a regular expression, so it would also upload, for example index@html if it existed) (实际上,它是一个正则表达式,因此它也会上载,例如index@html如果存在))
This suggests that you might want to make that regular expression match all HTML files: 这表明您可能要使该正则表达式匹配所有HTML文件:

- url: /(.*\.html)
  static_files: \1
  upload: .*\.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM