Created
April 30, 2012 03:47
-
-
Save snaka/2555272 to your computer and use it in GitHub Desktop.
GAEでのカスタムテンプレートタグの本体とそれを利用する側のソースコード例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| {% hello %} | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # custom template tag user | |
| import os | |
| from google.appengine.ext import webapp | |
| from google.appengine.ext.webapp import template | |
| template.register_template_library('tag_library.my_tags') | |
| class MainHandler(webapp.RequestHandler): | |
| def get(self): | |
| path = os.path.join(os.path.dirname(__file__), "hello.html") | |
| self.response.out.write(template.render(path, {})) | |
| app = webapp.WSGIApplication([('/', MainHandler)], | |
| debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment