I've tried to update my app before by changing
runtime: python27 , threadsafe: true , script: main.app"
It did work and was on python 2.7 but it didn't run properly I guess because my index.html didn't display when I went to the url http://dhsenviro.appspot.com. It is running on 2.5 now (because I want to keep it up). robots.txt is empty. How can I update it to 2.7 or should I update it to 3.x?
app.yaml :
application: dhsenviro
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css|psd|swf))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css|psd|swf))
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
- url: /.*
script: main.py
main.py :
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
def main ():
application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
util.run_wsgi_app (application)
if __name__ == '__main__':
main ()
I'd prefer not to upload my index.html, but I'm sure it's working properly.
Edit:
main.py :
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
class application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
def main ():
if __name__ == '__main__':
main ()
CORRECT APP.YAML :
application: dhsenviro
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css|psd|swf))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css|psd|swf))
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
- url: /.* script: main.application
CORRECT MAIN.PY
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)