Migrating to Python 2.7 - Google App Engine

A forum for general discussion of the Python programming language.

Migrating to Python 2.7 - Google App Engine

Postby Ramsudhir » Sun Feb 02, 2014 1:52 pm

Hello ALL

I am real new to Python scripting , i am trying to build a website in Google App Engine for a small project for my hobby. I found out that in google appEngine needs Python 2.7 Runtime but i have found 2.5 Python runtime which is not supported now.

i have 3 fils main.py, app.yaml, robots.txt the code as goes this way

app.yaml has code like
application: firstgoogleapp
version: 1
runtime: python
api_version: 1

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

- url: /robots.txt
static_files: robots.txt
upload: robots.txt

- url: .*
script: main.py

the main.py has

Code: Select all
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 ()

robots.txt has
User-agent: *
Disallow: /
Allow: /main

can any body can help me in this will greatful to me and i will able to lean Python

Last edited by metulburr on Sun Feb 02, 2014 2:47 pm, edited 2 times in total.
Reason: op lock, added code tags
Posts: 1
Joined: Sun Feb 02, 2014 12:20 pm

Re: Migrating to Python 2.7 - Google App Engine

Postby hrs » Sun Feb 02, 2014 11:12 pm

So what's the problem? What doesn't work? If you get a traceback, what is it?
Posts: 86
Joined: Thu Feb 07, 2013 9:26 pm

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 4 guests