sreenath sreenath sreenath sreenath - 2 months ago 6
HTML Question

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. It only fails when I head to 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:

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


I've checked the dashboard and find that the HTML files are there. I am new to website deployment and design. Can anyone suggest possible errors? I have already visited many sites for a solution.

Answer

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:

- 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)
This suggests that you might want to make that regular expression match all HTML files:

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