開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python (プログラミング言語)
Head First Python (Paul Barry(著)、 O'Reilly Media )のChapter 10(Scaling your Webapp: Getting real)、APP ENGINE CODE MAGNETS(p.371)を解いてみる。
APP ENGINE CODE MAGNETS(p.371)
コード(BBEdit, Emacs)
hfwwg.py
#-*- coding: utf-8 -*- from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db from google.appengine.ext.webapp import template from google.appengine.ext.db import djangoforms import hfwwgDB print(sys.path) print(sys.versionm) class SightingForm(djangoforms.ModelForm): class Meta: model = hfwwgDB.Sighting class SightingInputPage(webapp.RequestHandler): def get(self): html = template.render('templates/header.html', {'title': 'Report a Possible Sighting'}) html += template.render('templates/form_start.html', {}) html += str(SightingForm(auto_id=False)) html += template.render('templates/form_end.html', {'sub_title':'Submit Sighting'}) html += template.render('templates/footer.html', {'links':''}) self.response.out.write(html) app = webapp.WSGIApplication({('/.*', SightingInputPage)}, debug=False) def main(): run_wsgi_app(app) if __name__ == '__main__': main()
0 コメント:
コメントを投稿