Right now we are trying to make it really easy to hook a database into
Pecan, but the
bad news is that we are still in the process of implementing it.
There is no current definite way of doing this at the moment.
For some projects I have been using Elixir and SqlAlchemy, and the database
binding functions are in the model. So when the application runs via start.py
I import those binding functions and call them there with whatever
engine I want.
For example a start.py that connects to mysql would have these lines:
from my_app.model import my_binding_func
my_binding_func('mysql://127.0.0.1/my_database')
Again, this might not be straightforward and could be changing a bit later on.
Ideally, you would want to bind to a database connection before the
application gets to your
root controller.
This might be a question of preference, but in my case, anything
related to the database
I usually add it to the model module of my application.
The reason that goes into start.py is because start.py is in charge of
starting your application.
Now your situation/environment might be different and you *could* do
it in the root controller, like
this example for App Engine:
https://github.com/cleverdevil/pecan/blob/master/docs/0.0.1/source/app_engine.rst
It all depends.
For now there are no strict ways of doing it.