Overnight hack, trying to create an environment where GAE code (using Python libs/packages) could be easily ported over to Heroku with minimal editing.
EDIT
Q: YAML offers static file sharing with only 3 lines of code, I'm trying to figure out how to implement this file sharing with _minimal_editing_ (keyword).
For example, to share the 'static/' folder. One solution is to implement a number of classes found in http://docs.webob.org/en/latest/file-example.html - not an elegant answer.
The big picture is to empower the developer with the freedom of choice to choose a (hopefully) better/cheaper cloud provider, follow steps 1,2,3... and the app will be up and running with minimal fuss. Hope this clears up the confusion.
In case anyone inquires, my code is as follows...
The "main.py" file:
import jinja2 import webapp2 import os jinja_environment = jinja2.Environment( loader=jinja2.FileSystemLoader( os.path.join(os.path.dirname(__file__), 'templates'))) class HelloWebapp2(webapp2.RequestHandler): def get(self): template_values = { 'test': 'Hello World!!'} template = jinja_environment.get_template('jinja2_test.html') return self.response.out.write(template.render(template_values)) app2 = webapp2.WSGIApplication([ ('/', HelloWebapp2) ], debug=True) def main(): from paste import httpserver port = int(os.environ.get("PORT", 5000)) httpserver.serve(app2, host='0.0.0.0', port=port) if __name__ == '__main__': main()
In the "requirements.txt" file:
Jinja2==2.6 webapp2==2.3 paste==1.7.5.1 webob==1.1.1
The output file "templates/jinja2_test.html":
{{test}}
The default "procfile":
web: python main.py