I was able to do what I intend after having read more about loading dynamic Python code.
Here is a sample code. I removed the headers to make them easier:
Thanks anyway!
==============
class DynCode(db.Model): name = db.StringProperty() code = db.TextProperty(default=None)
==============
class MainHandler(webapp.RequestHandler): def get(self): dyn = DynCode() dyn = "index" dyn.code = """ from google.appengine.ext import webapp class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write("Hello World\\n") self.response.out.write("Hello World 2\\n") """ dyn.put() self.response.out.write("OK.") def main(): application = webapp.WSGIApplication([('/update', MainHandler)], debug=True) util.run_wsgi_app(application) if __name__ == '__main__': main()
====================================
def main(): query = DynCode.all() dyncodes = query.fetch(1) module = imp.new_module('mymodule') for dyn in dyncodes: exec dyn.code in module.__dict__ application = webapp.WSGIApplication([('/', module.MainHandler)], debug=True) util.run_wsgi_app(application) if __name__ == '__main__': main()
=========================
hgf
source share