I have a Google App Engine application in which I would like to bring Polymer components. I thought the best way to get started is to bring the initial project to the Google App Engine, so I created a new Google App Engine application using the Google App Engine Launcher. Then I created my application in Google App Engine.
URL of this test application: http://polymertvshelp.appspot.com/
So, I moved the Polymer project to my folder and uploaded it to the Google App Engine
The app lands on a page that displays
Hello World!
text.
So, I find a message that talks about the next steps, but I'm missing something. Post URL
In Mike's post, the author gave me the code for main.py, which I changed by deleting the following
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello world!')
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
Then I put Mike's code in the file
import random
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:
i = random.randint(1,11)
q = 'step-2/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 GuideHandler(webapp.RequestHandler):
def get (self, q):
q = 'icgt-registration-guide.pdf'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'application/pdf'
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 ()
this is the only code that is now executed in this main.py file
I also modified the app.yaml file to look like
application: polymerxxxx
version: 2
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.app
- url: /components
static_dir: components
- url: /images
static_dir: images
I also changed index.html in the step-2 folder, deleting .. before the relative paths.
When I run the application, I now get a 500 server error
Error: server error
The server detected an error and could not fulfill your request. Try again after 30 seconds.
I hope someone can make me go because I really would like to play with some of these components.
Hi,
Chris