2014-01-14 83 views
2

我做了一个网站,我暂时在应用程序引擎中托管。当我打开计算机上的HTML文件时,我可以浏览页面。它只有当我前往http://www.alshafarconstruction.appspot.com/index.html时才会失败。在服务器上找不到请求的网址错误

错误消息:

Error: Not Found 

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

的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:

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() 

我检查了dashb oard,并发现HTML文件在那里。我是网站部署和设计的新手。任何人都可以提出可能的错我已经访问过很多网站寻求解决方案。

+0

在仪表板中,是否有预置“contact.html”页面的新链接?如果你点击它,你会得到什么样的URL? –

+0

可能是一个想法,粘贴为管理路由你的app.yaml等 –

+0

@PaulCollingwood已经张贴aslso作为更新用了我的问题 –

回答

1

The documentation暗示的静态和应用程序文件单独上传,因此,尽管文件可能在那里,这也许是因为他们在应用程序文件的一部分被上传。

您现在有一个upload指令告诉它只能上载index.html

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

(实际上,这是一个正则表达式,所以它也将上传,例如[email protected]如果它存在)
这建议您可能希望使该正则表达式匹配所有HTML文件:

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

你的意思是我必须用你在下面给出的代码更改App文件 –

+0

@sreenathsreenath:是的;您需要更改'app.yaml',以便与HTML文件对应的部分具有'。\ \。html'的'upload'属性。 – icktoofay

+0

谢谢你救了我从地狱..现在的作品谢谢你兄弟 –

相关问题