Pyramid Tutorial — Pyramid Tutorial for PyCon JP Sprint 1.0 documentation Make a note of the points you were addicted to with reference to.
Add the following to the beginning of views.py
python
from pyramid.httpexceptions import HTTPFound
Let's work with the defined BankAccount model in the interpreter.
python
>>> from bankaccount import models
If you can't import around zope.sqlalchemy, you're probably doing it from the python prompt. I think that the import error will disappear below.
python
pshell development.ini
I overlooked what to do when I came here.
python
>>> from bankaccount import models
>>> models.Base.metadata.create_all()
>>> b = models.BankAccount(name=u'default')
>>> models.DBSession.add(b)
>>> import transaction
>>> transaction.commit()
There is a way to pass the templates folder to the beginning of the tutorial, so use it.
File | Description |
---|---|
development.ini | db definition, debugtoolbar display settings |
bankaccount.db | real db file |
bankaccount/init.py | route setting, path specification of mako template |
bankaccount/views.py | controller |
bankaccount/models.py | db table definition and model |
bankaccount/resources.py | Get the balance |
bankaccount/templates/index.mak | Balance display, deposit, withdrawal |